In Webpack, I have the following plugins:
plugins: [
new ExtractTextPlugin(\'styles.css\'),
new webpack.optimize.UglifyJsPlugin({
com
You can use noop-webpack-plugin (noop means no operation):
const isProd = process.env.NODE_ENV === 'production';
const noop = require('noop-webpack-plugin');
// ...
plugins: [
isProd ? new Plugin() : noop(),
]
Or better/recommended solution with no additional module:
const isProd = process.env.NODE_ENV === 'production';
// ...
plugins: [
isProd ? new Plugin() : false,
].filter(Boolean)
// filter(Boolean) removes items from plugins array which evaluate to
// false (so you can use e.g. 0 instead of false: `new Plugin() : 0`)