Skip to content

Mangling error fixed with Terser, not UglifyJS #85

@stuartlangridge

Description

@stuartlangridge

https://github.com/optoolco/tonic/blob/master/HELP.md under the heading "Webpack 4+ Mangling Error" suggests that a "Mangling" error in the console when using webpack is fixable by adding the keep_fnames option to the UglifyJS config in your webpack config. However, Webpack now comes with TerserPlugin out of the box, and it's that that's mangling the names by default; it may be worth adding to those docs to suggest making a change as follows:

...
    optimization: {
        minimizer: [ // needed for Tonic
            new TerserPlugin({
                terserOptions: {
                    keep_fnames: true
                }
            })
        ]
    }
...

to the webpack configuration. (This is exactly what's there already, except for Terser, not UglifyJS).

This isn't a PR because there may be other better Tonic-ish options that should also be set for Terser and I don't know what they would be.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions