gpt4 book ai didi

javascript - Webpack UglifyJS 仍然发出警告消息

转载 作者:行者123 更新时间:2023-11-28 18:35:05 27 4
gpt4 key购买 nike

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 。我希望它有帮助。

关于javascript - Webpack UglifyJS 仍然发出警告消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37243138/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com