不支持`warnings`选项,来自UglifyJs的错误

时间:2019-05-05 07:14:57

标签: webpack uglifyjs

tt

今天building for production...[ Error: static/js/0.e5262afb6d92aae69c76.js from UglifyJs `warnings` is not a supported option at Function.buildError (/mypath/node_modules/_uglifyjs-webpack-plugin@2.0.1@uglifyjs-webpack-plugin/dist/index.js:114:12) at results.forEach (/mypath/node_modules/_uglifyjs-webpack-plugin@2.0.1@uglifyjs-webpack-plugin/dist/index.js:255:52) at Array.forEach (<anonymous>) at taskRunner.run (/mypath/node_modules/_uglifyjs-webpack-plugin@2.0.1@uglifyjs-webpack-plugin/dist/index.js:242:17) at step (/mypath/node_modules/_uglifyjs-webpack-plugin@2.0.1@uglifyjs-webpack-plugin/dist/TaskRunner.js:76:9) at done (/mypath/node_modules/_uglifyjs-webpack-plugin@2.0.1@uglifyjs-webpack-plugin/dist/TaskRunner.js:84:30) at boundWorkers (/mypath/node_modules/_uglifyjs-webpack-plugin@2.0.1@uglifyjs-webpack-plugin/dist/TaskRunner.js:89:13) at /mypath/node_modules/_worker-farm@1.7.0@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 时发生此错误,

4天前万事大吉。

今天,当我更新本地的node_modules时,它就发生了。

我认为应该是几天前发布新版本的某些软件包

任何帮助将不胜感激!


更新

此错误是由最新版本uglify-js@3.5.10引起的, 删除选项中的npm run build可以暂时解决此错误。

warnings

1 个答案:

答案 0 :(得分:3)

这是由Uglify-js的升级引起的,详情请参见https://github.com/mishoo/UglifyJS2/issues/3394

解决方案是:

使用:

{
    "warnings": value
}

代替:

{
    "compress": {
        "warnings": value
    }
}