webpack does not recognize command-line options

1.7k views Asked by At

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?

1

There are 1 answers

1
Stevie-Ray Hartog On

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