Optimize CSS for production using webpack 4

时间:2018-12-03 13:02:57

标签: reactjs webpack-4

I want to use OptimizeCSSAssetsPlugin for optimizing CSS in my react application. Tutorial here

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

The thing is that they add it in minimizer, which will override all other optimizations in production, including:

  • FlagDependencyUsagePlugin
  • FlagIncludedChunksPlugin
  • ModuleConcatenationPlugin
  • NoEmitOnErrorsPlugin
  • OccurrenceOrderPlugin
  • SideEffectsFlagPlugin
  • UglifyJsPlugin

https://webpack.js.org/concepts/mode/

And when add OptimizeCSSAssetsPlugin to minimizer, they override all the default plugin and I notice that they also add UglifyJsPlugin to minimizer.

My questions is that why dont we add OptimizeCSSAssetsPlugin to plugins array instead of minimizer and be happy with other default plugins?

0 个答案:

没有答案