question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Example of replacing the minimizer

See original GitHub issue

Is 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:closed
  • Created 5 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
just-jebcommented, Jan 20, 2020

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 good custom-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:

  1. Completely drop the support for es5 by modifying browserlist file (only allow browsers that support es6).
  2. Compile your code to es5 instead of es6, which will effectively support older versions of browsers but increase bundle size. This can be done by setting the target in tsconfig.json to es5 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.

5reactions
just-jebcommented, Nov 17, 2018

Have you specified merge strategy replace for optimization? 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 or verbose option. Would be useful to me as well as to the users.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found