1

I feel kinda stupid asking this but can't find answers elsewhere.
I am upgrading the webpack for our product from v1 (yes) to v4 and I'm new to all this. I installed both webpack and webpack-cli:

$ ./node_modules/.bin/webpack -v

webpack-cli 4.0.0

webpack 4.44.2

but it does not recognize the options listed in the documentation like -p, --optimize-minimize etc.

$ ./node_modules/.bin/webpack -p
[webpack-cli] Unknown argument: -p

What's the catch?

davka
  • 13,974
  • 11
  • 61
  • 86

1 Answers1

2

Webpack v4+ will minify your code by default in production mode.

https://webpack.js.org/guides/production/

To minimise CSS: https://webpack.js.org/plugins/mini-css-extract-plugin/#minimizing-for-production

  • 2
    So this section of Webpack 4 documentation is incorrect: > Note that the --optimize-minimize flag can be used to enable TerserPlugin as well. https://v4.webpack.js.org/guides/tree-shaking/#minify-the-output – Nighto Nov 19 '21 at 12:43