Example of replacing the minimizer
See original GitHub issueIs your feature request related to a problem? Please describe. I’m trying to replace the options for the minimizer in angular-cli 7. But it doesn’t seem to be working. No matter what config I set, the standard minimizer seems to be running.
Describe the solution you’d like Is there a way to view the final webpack config output? I’m concerned I’m just appending another minimizer rather than replacing it. Or just an example of replacing the minimizer. I’m not 100% clear on how the “merging” of configs works.
Thanks!
This is my extra-webpack.config.js
const TerserPlugin = require('terser-webpack-plugin');
module.exports = {
optimization: {
minimizer: [new TerserPlugin({
parallel: true,
cache: true,
terserOptions: {
ecma: undefined,
warnings: false,
parse: {},
compress: {
warnings: false, // Suppress uglification warnings
pure_getters: true,
unsafe: true,
unsafe_comps: true
},
mangle: true, // Note `mangle.properties` is `false` by default.
module: false,
output: null,
toplevel: false,
nameCache: null,
ie8: false,
keep_classnames: undefined,
keep_fnames: false,
safari10: false
}
})]
}
};
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Maximizing or Minimizing a Function.mp4 - YouTube
Linear Programming (Optimization) 2 Examples Minimize & Maximize. Mario's Math Tutoring. Mario's Math Tutoring. •. •. 294K views 2 years ago ...
Read more >Minimizing: Definition in Psychology, Theory, & Examples
What is minimizing? Read on to learn more about the underlying theory of minimization, discover its causes, and explore tips to deal with...
Read more >Minimizer - an overview | ScienceDirect Topics
Firstly, it is observed that, by suitably folding the film, its bulk membrane energy can be reduced to values arbitrarily close to zero....
Read more >Improved design and analysis of practical minimizers
Minimizers are methods to sample k-mers from a string, with the guarantee that similar set of k-mers will be chosen on similar strings....
Read more >Remove Windows Risk Minimizer (Uninstall Guide)
This guide teaches you how to remove Windows Risk Minimizer for free by following easy step-by-step instructions.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So, for any newcomers a short recap of what’s been discussed here and researched in the sources.
In order to change the minimizer settings you have to change the configuration of
TerserPlugin
. Nothing complicated, just the old goodcustom-webpack
builder, read the docs.HOWEVER, in order for these changes to be applied the
differentialLoading
must be switched off. To do this you can either:es5
by modifyingbrowserlist
file (only allow browsers that supportes6
).es5
instead ofes6
, which will effectively support older versions of browsers but increase bundle size. This can be done by setting the target intsconfig.json
toes5
or not setting it at all (es5
is the default option for Angular).Background: After the webpack build is done Angular is doing its own post-processing which disregards
TerserPlugin
options and does stuff like mangling in any case.Have you specified merge strategy
replace
foroptimization
? You might want to take a look at this comment.Regarding viewing the final webpack config - not possible without changing the sources. I’m considering adding a
debug
orverbose
option. Would be useful to me as well as to the users.