并行uglify webpack模块

时间:2016-08-12 15:19:46

标签: node.js webpack

我使用当前的uglify模块如下

uglifyPlugin = new webpack.optimize.UglifyJsPlugin({
        sourcemaps: false,
        compress: {
            warnings: false
        }
    }),

 plugins: [
            commonsPlugin,
            dedupePlugin,
            uglifyPlugin,
            fnCaseSensitivityPlugin,
            sourceMapPlugin,
            fnDonePlugin
        ]

我想使用并行uglifyPlugin,我该怎么办? https://www.npmjs.com/package/webpack-parallel-uglify-plugin

我很困惑

1 个答案:

答案 0 :(得分:0)

首先使用npm安装插件。

npm install --save-dev webpack-parallel-uglify-plugin

然后在webpack.config.js文件中替换当前使用的uglify插件。

const ParallelUglifyPlugin = require('webpack-parallel-uglify-plugin');
const parallelUglifyPlugin = new ParallelUglifyPlugin({});

module.exports = {
  plugins: [
    commonsPlugin,
    dedupePlugin,
    parallelUglifyPlugin, // <-- new plugin
    fnCaseSensitivityPlugin,
    sourceMapPlugin,
    fnDonePlugin
  ]
};