Misc. tweaks to improve webpack performance (#2994)

* Misc. tweaks to improve webpack performance

* Fix code climate style issues
This commit is contained in:
Benjamin Yolken 2017-06-20 08:40:33 -07:00 committed by Maxime Beauchemin
parent 9051e1f3e2
commit de88764e93
2 changed files with 13 additions and 2 deletions

View File

@ -12,7 +12,7 @@
"cover": "babel-node node_modules/.bin/babel-istanbul cover _mocha -- --require spec/helpers/browser.js --recursive spec/**/*_spec.*",
"dev": "NODE_ENV=dev webpack --watch --colors --progress --debug --output-pathinfo --devtool inline-source-map",
"prod": "NODE_ENV=production node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js -p --colors --progress",
"build": "NODE_ENV=production webpack --colors --progress",
"build": "NODE_ENV=production webpack --colors --progress &> /tmp/webpack.log",
"lint": "eslint --ignore-path=.eslintignore --ext .js,.jsx .",
"sync-backend": "babel-node --presets es2015 javascripts/syncBackend.js"
},

View File

@ -125,6 +125,17 @@ const config = {
],
};
if (process.env.NODE_ENV === 'production') {
config.plugins.push(new webpack.optimize.UglifyJsPlugin());
config.plugins.push(
// Using settings suggested in https://github.com/webpack/webpack/issues/537
new webpack.optimize.UglifyJsPlugin({
sourceMap: false,
minimize: true,
compress: {
drop_debugger: true,
warnings: false,
drop_console: true,
},
}),
);
}
module.exports = config;