Commit 2775d37f authored by Jens's avatar Jens
Browse files

add editor src

parent 0ab82a8a
declare module 'postgraphile'
\ No newline at end of file
declare module 'react-async-bootstrapper'
\ No newline at end of file
{
"compilerOptions": {
"noImplicitAny": true,
"module": "commonjs",
"target": "es2016",
"jsx": "react",
"lib": [
"es2016",
"dom",
"esnext.asynciterable"
]
}
}
\ No newline at end of file
const path = require('path');
const webpack = require("webpack");
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const StatsWriterPlugin = require("webpack-stats-plugin").StatsWriterPlugin;
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const IS_PRODUCTION = process.env.NODE_ENV === 'production';
console.log('IS_PRODUCTION: ', IS_PRODUCTION);
let plugins = [
new webpack
.optimize
.CommonsChunkPlugin({
name: 'vendor',
filename: 'vendor.js',
minChunks: function (module, count) {
return module.context && module
.context
.indexOf("node_modules") !== -1;
}
}),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': IS_PRODUCTION ? JSON.stringify('production') : JSON.stringify('develop')
}
}),
/*new webpack
.optimize
.AggressiveMergingPlugin(),
new webpack
.optimize
.OccurrenceOrderPlugin(),
new UglifyJSPlugin(),
new webpack.LoaderOptionsPlugin({minimize: true, debug: false}),
new CompressionPlugin({
asset: "[path].gz[query]",
algorithm: "gzip",
test: /\.(js|html|css)$/,
threshold: 0,
minRatio: 0.8
})*/
];
if (IS_PRODUCTION) {
plugins.push(new BundleAnalyzerPlugin({analyzerMode: 'static'}));
} else {
plugins.push(new webpack.HotModuleReplacementPlugin());
plugins.push(new webpack.NoEmitOnErrorsPlugin());
}
const loaders = IS_PRODUCTION
? [
{
loader: 'awesome-typescript-loader'
}
]
: [
{
loader: 'react-hot-loader/webpack'
}, {
loader: 'awesome-typescript-loader'
}
];
module.exports = {
entry: IS_PRODUCTION
? ['./src/client/client.tsx']
: [
'webpack-hot-middleware/client', './src/client/client.tsx'
],
output: {
filename: 'client.js',
path: path.resolve(__dirname, 'dist/client'),
publicPath: '/'
},
// Enable sourcemaps for debugging webpack's output.
devtool: "inline-source-map",
resolve: {
// Add '.ts' and '.tsx' as resolvable extensions.
extensions: [".ts", ".tsx", ".js", ".json"]
},
plugins,
module: {
rules: [
// All files with a '.ts' or '.tsx' extension will be handled by
// 'awesome-typescript-loader'.
{
test: /\.tsx?$/,
exclude: /(node_modules|bower_components)/,
use: loaders
},
// All output '.js' files will have any sourcemaps re-processed by
// 'source-map-loader'.
{
enforce: 'pre',
test: /\.js$/,
loader: "source-map-loader",
exclude: [/node_modules/, /build/, /__test__/]
}
]
}
};
\ No newline at end of file
const path = require('path');
const fs = require('fs');
const webpack = require("webpack");
const IS_PRODUCTION = process.env.NODE_ENV === 'production';
let nodeModules = {};
fs.readdirSync('node_modules')
.filter(function (x) {
return ['.bin'].indexOf(x) === -1;
})
.forEach(function (mod) {
nodeModules[mod] = 'commonjs ' + mod;
});
const loaders = IS_PRODUCTION ?
[
{
loader: 'awesome-typescript-loader'
}
] :
[
{
loader: 'react-hot-loader/webpack'
},
{
loader: 'awesome-typescript-loader'
}
];
module.exports = {
entry: [
"./src/server/server.tsx"
],
output: {
filename: "server.js",
path: __dirname + "/dist/server"
},
target: 'node',
externals: nodeModules,
devtool: "source-map",
resolve: {
extensions: [".ts", ".tsx", ".js", ".json"]
},
plugins: [
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1
})
],
module: {
rules: [
// All files with a '.ts' or '.tsx' extension will be handled by 'awesome-typescript-loader'.
{
test: /\.tsx?$/,
exclude: /(node_modules|bower_components)/,
use: loaders
},
// All output '.js' files will have any sourcemaps re-processed by 'source-map-loader'.
{
enforce: 'pre',
test: /\.js$/,
loader: "source-map-loader",
exclude: [/node_modules/, /build/, /__test__/]
}
]
}
};
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment