From 15bf2b6da859f2ab73fab5838689291830005c66 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Fri, 3 Feb 2017 22:05:09 +0800 Subject: [PATCH] Update webpack config to use parallel uglify plugin to speed up production build --- package.json | 3 ++- webpack.production.js | 15 +++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 74de2c80..d5e8e55c 100644 --- a/package.json +++ b/package.json @@ -163,6 +163,7 @@ "script-loader": "^0.7.0", "style-loader": "^0.13.1", "url-loader": "^0.5.7", - "webpack": "^1.14.0" + "webpack": "^1.14.0", + "webpack-parallel-uglify-plugin": "^0.2.0" } } diff --git a/webpack.production.js b/webpack.production.js index b28c34ae..7c690d28 100644 --- a/webpack.production.js +++ b/webpack.production.js @@ -3,6 +3,7 @@ var webpack = require('webpack'); var path = require('path'); var ExtractTextPlugin = require("extract-text-webpack-plugin"); var OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin'); +var ParallelUglifyPlugin = require('webpack-parallel-uglify-plugin'); module.exports = [Object.assign({}, baseConfig, { plugins: baseConfig.plugins.concat([ @@ -11,12 +12,14 @@ module.exports = [Object.assign({}, baseConfig, { 'NODE_ENV': JSON.stringify('production') } }), - new webpack.optimize.UglifyJsPlugin({ - compress: { - warnings: false - }, - mangle: false, - sourceMap: false + new ParallelUglifyPlugin({ + uglifyJS: { + compress: { + warnings: false + }, + mangle: false, + sourceMap: false + } }), new ExtractTextPlugin("[name].[hash].css") ]),