输出如下:
WARNING Compiled with 20 warnings4:38:29 PM
warning
warning
以此类推,“警告” 20次,但没有一条警告消息。
我的webpack配置如下:
module.exports = {
plugins : [ new ImageminPlugin( {
optipng : { optimizationLevel : 2 },
gifsicle : { optimizationLevel : 3 },
pngquant : {
quality : '65-90',
speed : 4,
},
svgo : {
plugins : [ { removeUnknownsAndDefaults : false }, { cleanupIDs : false }, { removeViewBox : false } ],
},
plugins : [ imageminMozjpeg( { quality : 75 } ) ],
disable : ( config.enabled.watcher ),
} ), new UglifyJsPlugin( {
uglifyOptions : {
ecma : 5,
compress : {
drop_console : true,
},
warnings : true,
},
} ) ],
};
如果我在warnings
下将false
设置为uglifyOptions
,除2条警告外,其余所有警告都将消失,因此我能想到的是UglifyJS正在生成大多数警告。我正在使用最新版本的Node,NPM,webpack和UglifyJS webpack插件。我正在Windows上运行它。无论使用Git Bash还是PowerShell,我都会得到相同的输出。
答案 0 :(得分:0)
好的,我要澄清一下,上面的webpack配置清单只是其中的一部分。这是与主要文件不同的配置文件,只有在生产模式下编译时才加载(我当时是)。主要配置有一个-DNDEBUG
对象:
stats
最初,let webpackConfig = {
...
stats : {
hash : true,
version : true,
timings : true,
children : false,
errors : true,
errorDetails : true,
warnings : true,
chunks : false,
modules : false,
reasons : true,
source : true,
publicPath : true,
},
...
设置为warnings
,我只是将其更改为false
,并进行了修复。我应该在我的问题中发布这两个配置,以示歉意。