webpack-contrib / uglifyjs-webpack-plugin

[deprecated] UglifyJS Plugin
MIT License
1.38k stars 179 forks source link

Adding the mangle property causes 'invalid options' #390

Closed RyenNelsen closed 5 years ago

RyenNelsen commented 5 years ago

Expected Behavior

I would expect it to actually compile if the mangle property is set.

Actual Behavior

While compiling, webpack exits with the error:

UglifyJs Plugin Invalid Options

options should NOT have additional properties

ValidationError: UglifyJs Plugin Invalid Options

Code

  // webpack.config.js
  optimization: {
    minimizer: [
      new UglifyjsWebpackPlugin({
        cache: true,
        parallel: true,
        mangle: false,
      }),
    ],
  },

I also tried:

  // webpack.config.js
  optimization: {
    minimizer: [
      new UglifyjsWebpackPlugin({
        cache: true,
        parallel: true,
        mangle: true,
      }),
    ],
  },

How Do We Reproduce?

Just try setting the mangle property.

If I remove the property, webpack will compile and UglifyJs will mangle the output. My end goal is to be able to set mangle.properties.

alexander-akait commented 5 years ago

https://github.com/webpack-contrib/uglifyjs-webpack-plugin#uglifyoptions

Put this option in uglifyOptions option.