Reputation: 3953
I used to use Webpack 3 where I had 3 different builds:
A full debug build where the code is unminified and is similiar to the mode=development.
A test build where it is similar to mode=development but it uses minified code for smaller package size.
A prod build which is basically the same as mode=production and the -p flag.
What I a having trouble is replicating my 'test' build where I had a development version of my bundle (mainly to keep react development tools) but had a bundle size that was nearly close to my production build.
Here is what I have:
NODE_ENV='development' webpack --optimize-minimize --mode=development
This no longer works as the optimize-minimize flag is being ignored so my bundle is pretty big.
Upvotes: 1
Views: 1261
Reputation:
Use the webpack.config.js file, and ensure minimize is set to true within optimization.
optimization: {
minimize: true,
minimizer: [new TerserPlugin({
terserOptions: {
mangle: true, // Note `mangle.properties` is `false` by default.
},
})],
},
Upvotes: 2