Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do you use the --optimize-minimize flag with webpack

Tags:

webpack

How should I go about using the --optimize-minimize flag with webpack. What does adding that flag to the command do? Do I still need to add the UglifyJsPlugin to the plugins list in the webpack config if I am using the --optimize-minimize flag? Does it help me decide whether to add it to the list of plugins or not?

like image 429
Vish Avatar asked Jan 28 '16 23:01

Vish


People also ask

What is optimization in webpack?

Tells webpack to determine and flag chunks which are subsets of other chunks in a way that subsets don't have to be loaded when the bigger chunk has been already loaded. By default optimization. flagIncludedChunks is enabled in production mode and disabled elsewise. webpack.config.js module. exports = { //...

Does webpack automatically minify?

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

Does webpack use Terser?

This plugin uses terser to minify/minimize your JavaScript.


1 Answers

What does adding that flag to the command do?

It will reduce your js/CSS files size.

Do I still need to add the UglifyJsPlugin to the plugins list in the webpack config if I am using the --optimize-minimize flag?

Same effect, so you can choose what you like.

Does it help me decide whether to add it to the list of plugins or not?

As a suggestion, always use this or use it before putting the code to production(maybe this process will slow down the building process).

like image 150
David Guan Avatar answered Sep 24 '22 17:09

David Guan