Webpack UglifyJS 仍然给出警告信息

Webpack UglifyJS still giving warning messages

A lot of warnings with webpack uglify

我已经关闭了 UglifyJS 中的警告,但我仍然收到一些来自 webpack 的警告。

WARNING in main-0.2.8.js from UglifyJs
Dropping unused variable e [./~/bluebird/js/browser/bluebird.js:29,292]
Dropping unused variable o [./~/bluebird/js/browser/bluebird.js:29,292]
Dropping unused variable i [./~/bluebird/js/browser/bluebird.js:29,292]
Non-strict equality against boolean: == false [./~/aurelia-pal-browser/dist/commonjs/aurelia-pal-browser.js:200,0]
Non-strict equality against boolean: == false [./~/aurelia-pal-browser/dist/commonjs/aurelia-pal-browser.js:208,0]

来自 webpack.config

的插件
  plugins: [
    new AureliaWebpackPlugin(),
    new HtmlWebpackPlugin({
      title: 'Aurelia webpack skeleton - ' + pkg.version,
      template: 'index.prod.html',
      filename: 'index.html'
    }),
    new ProvidePlugin({
      $: 'jquery',
      jquery: 'jquery',
      "windows.jquery": 'jquery'
    }),
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        warnings: false
      }
    })
  ]

如果有人知道如何摆脱最后的几个警告就好了。

当您最小化 UglifyJs 时,它会警告您它会删除未使用的变量,并将 !1true 中的 false 值更改为 !0。这不是问题,只是为了减少文件长度。另见 Javascript minification why is false replaced with !1 and true with !0。 但是,您可以尝试指定压缩选项以删除这些警告:

    compress: {
        warnings: false,
        booleans: false,
        unused: false
    }

有关详细信息,请参阅 https://github.com/mishoo/UglifyJS2#compressor-options。希望对你有帮助。