Mini-css-extract-plugin: Out is not run through optimization.minimizer

Created on 8 Mar 2018  ·  4Comments  ·  Source: webpack-contrib/mini-css-extract-plugin

I'm not sure if this is a bug or omission in the docs (still wrapping my head around all the webpack 4 changes), but the output is not minimized in production mode using the webpack defaults.

Most helpful comment

Thanks @sokra. I couldn't find documentation on how to properly configure optimization.mimimizier (It seems that quite a few of the 4.x features are still missing from the webpack site [or I'm too dumb to find them!]).

Anyway, I added optimize-css-assets-webpack-plugin back to my config, which works with mini-css-extract-plugin exactly the same as it did with extract-text. I might suggest that you add a note on the readme either explaining how to add minimization with optimization.mimimizier(which would be awesome!), or mention that a plugin is needed, since I think the new expectation with webpack 4 is that mode=production will fully optimize the build by default.

All 4 comments

yep, by default webpack only comes with a JS minimizer (uglifyjs).

You can add a CSS minimizer via optimization.minimizer: [...]

Thanks @sokra. I couldn't find documentation on how to properly configure optimization.mimimizier (It seems that quite a few of the 4.x features are still missing from the webpack site [or I'm too dumb to find them!]).

Anyway, I added optimize-css-assets-webpack-plugin back to my config, which works with mini-css-extract-plugin exactly the same as it did with extract-text. I might suggest that you add a note on the readme either explaining how to add minimization with optimization.mimimizier(which would be awesome!), or mention that a plugin is needed, since I think the new expectation with webpack 4 is that mode=production will fully optimize the build by default.

Yep, I'll do. Or you could send a PR.

webpack 5 will probably include a CSS minimizer by default, just like with uglifyjs.

:-) Added a note in PR #35

Was this page helpful?
0 / 5 - 0 ratings