Skip to content
This repository was archived by the owner on Dec 5, 2019. It is now read-only.
This repository was archived by the owner on Dec 5, 2019. It is now read-only.

Turn off inlining in optimization until UglifyJS issue is fixed. #264

Closed
@webpack-bot

Description

@webpack-bot

This minimization bug has been open for almost two months: mishoo/UglifyJS#2842. It has been referenced here elsewhere. The bug occurs when UglifyJS attempts to inline a call to a function with a variable of the same name as a variable in the calling function. Symptoms usually include "is not defined" or "assignment to constant variable".

In my experience, it's both easy to fall into and extremely time-consuming to diagnose.

I'd suggest turning inline: false in Webpack 4 until this is fixed. From the comments, it looks like UglifyJS2 is suffering from a lack of contributors with the skills and bandwidth needed to deal with things like this.

All of the Webpack 4 blogging has been about "Just let us do it for you." IMHO, to fulfill the implied promise, I think you need to be reactive to component issues like this.

Related: optimization.minimize and optimization.minimizer (along with the rest of optimization) need documenting.

For this particular issue, I'm using:

{
optimization:
            minimizer: [
               
                new UglifyJsPlugin({
                    parallel: true,  // Webpack default
                    cache: true      // Webpack default
                    uglifyOptions: {
                        /*
                            inlining is broken sometimes where inlined function uses the same variable name as inlining function.
                            See https://github.com/mishoo/UglifyJS2/issues/2842, https://github.com/mishoo/UglifyJS2/issues/2843
                         */
                        compress: { inline:false },
                    },
                })
            ],
}


This issue was moved from webpack/webpack#6798 by @evilebottnawi. Original issue was by @estaub.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions