我正在尝试转换以下命令:
uglifyjs src1.js src2.js -c -m toplevel --screw-ie8
API 调用:
ug.minify(['src1.js','src2.js'], {mangle:true, compress:true, ie_proof:false})
但我不知道如何设置“toplevel”。设置 toplevel:true
或 mangle:'toplevel'
不起作用。
最佳答案
将 toplevel
选项放入对象文字中:
require('uglify-js').minify(['src1.js','src2.js'], {
<strong> mangle: {
toplevel: true
},</strong>
compress: true,
ie_proof: false
});
关于javascript - UglifyJS 2 : api equivalent for cli -m toplevel?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21003890/