【问题标题】:`warnings` is not a supported option, Error from UglifyJs`warnings` 不是受支持的选项,来自 UglifyJs 的错误
【发布时间】:2019-05-05 07:14:57
【问题描述】:
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

今天npm run build时出现这个错误,

4 天前一切正常。

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

我想应该是前几天发布了新版本的某个包

任何帮助将不胜感激!


更新

这个错误是上个版本uglify-js@3.5.10引起的, 去掉选项中的warnings可以暂时修复这个错误。

    uglifyOptions: {
          compress: {
                warnings: false,
                pure_funcs: ['console.log']
          }
    }

【问题讨论】:

    标签: webpack uglifyjs


    【解决方案1】:

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

    解决办法是:

    使用:

    {
        "warnings": value
    }
    

    代替:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-05-06
      • 2021-12-21
      • 2018-11-24
      • 1970-01-01
      • 1970-01-01
      • 2017-12-20
      • 2017-08-03
      • 1970-01-01
      相关资源
      最近更新 更多