The following is the plugin property for mine webpack.config.js:
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery'
}),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production'),
}
}),
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false
}
}),
new CompressionPlugin({
asset: '{file}',
algorithm: 'gzip',
regExp: /\.js$|\.html$/,
})
],
Sometimes I want to turn it off CompressionPlugin, and sometimes I want to turn it on. However, it is inconvenient to create two webpack configuration files. I was wondering if there is a way to enable / disable the plugin dynamically using command line options?
For example, it will be great if I can use webpack --disable-compression-pluginto disconnect CompressionPlugin. Anyone have any ideas on this?
source
share