Refine webpack configuration per env

Add env-specific webpack configuration

Add basic env-specific webpack configuration

Use more advanced production uglify config

Simplify webpack loader config
pull/3300/head
Thibaud Colas 2016-09-22 22:54:57 +03:00
rodzic e18c1d99c8
commit 87b400d00b
3 zmienionych plików z 29 dodań i 5 usunięć

Wyświetl plik

@ -54,13 +54,9 @@ module.exports = function exports() {
module: {
loaders: [
{
test: /\.js$/,
test: /\.(js|jsx)$/,
loader: 'babel'
},
{
test: /\.jsx$/,
loader: 'babel'
}
]
}
};

Wyświetl plik

@ -1,3 +1,4 @@
var webpack = require('webpack');
var base = require('./webpack.base.config');
var config = base('development');
@ -7,4 +8,11 @@ config.watch = true;
// See http://webpack.github.io/docs/configuration.html#devtool
config.devtool = 'inline-source-map';
// Set process.env.NODE_ENV to development to enable JS development aids.
config.plugins.push(new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('development'),
},
}));
module.exports = config;

Wyświetl plik

@ -1,8 +1,28 @@
var webpack = require('webpack');
var base = require('./webpack.base.config');
var config = base('production');
// production overrides go here
config.plugins.push(new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production'),
},
}));
// See https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/config/webpack.config.prod.js.
config.plugins.push(new webpack.optimize.UglifyJsPlugin({
compress: {
screw_ie8: true,
warnings: false
},
mangle: {
screw_ie8: true
},
output: {
comments: false,
screw_ie8: true
},
}));
module.exports = config;