Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

`warnings` is not a supported option, Error from UglifyJs

building for production...[ Error: static/js/0.e5262afb6d92aae69c76.js from UglifyJs
  `warnings` is not a supported option
      at Function.buildError (/mypath/node_modules/[email protected]@uglifyjs-webpack-plugin/dist/index.js:114:12)
      at results.forEach (/mypath/node_modules/[email protected]@uglifyjs-webpack-plugin/dist/index.js:255:52)
      at Array.forEach (<anonymous>)
      at taskRunner.run (/mypath/node_modules/[email protected]@uglifyjs-webpack-plugin/dist/index.js:242:17)
      at step (/mypath/node_modules/[email protected]@uglifyjs-webpack-plugin/dist/TaskRunner.js:76:9)
      at done (/mypath/node_modules/[email protected]@uglifyjs-webpack-plugin/dist/TaskRunner.js:84:30)
      at boundWorkers (/mypath/node_modules/[email protected]@uglifyjs-webpack-plugin/dist/TaskRunner.js:89:13)
      at /mypath/node_modules/[email protected]@worker-farm/lib/farm.js:199:19
      at process._tickCallback (internal/process/next_tick.js:61:11),
  Error: static/js/1.89c4c336d047e363641c.js from UglifyJs

This error occurs when npm run build today,

all things are right 4 days ago.

Today when I update my local node_modules, it just happens.

I think it should be some package released new version a few day ago

Any help would be appreciated!


update

This error caused by last version [email protected], remove warnings in options can temporarily fix this error.

    uglifyOptions: {
          compress: {
                warnings: false,
                pure_funcs: ['console.log']
          }
    }
like image 627
Clocher Zhong Avatar asked May 05 '19 07:05

Clocher Zhong


1 Answers

It's caused by upgrade of Uglify-js, detail in : https://github.com/mishoo/UglifyJS2/issues/3394

The solution is :

use:

{
    "warnings": value
}

instead of:

{
    "compress": {
        "warnings": value
    }
}
like image 95
Clocher Zhong Avatar answered Nov 04 '22 02:11

Clocher Zhong