【问题标题】:UglifyJS 2: api equivalent for cli -m toplevel?UglifyJS 2:cli -m 顶层的 api 等效项?
【发布时间】:2014-01-08 18:39:50
【问题描述】:

我正在尝试转换以下命令:

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:truemangle:'toplevel' 不起作用。

【问题讨论】:

    标签: javascript uglifyjs uglifyjs2


    【解决方案1】:

    toplevel 选项放在对象文字中:

    require('uglify-js').minify(['src1.js','src2.js'], {
        mangle: {
            toplevel: true
        },
        compress: true,
        ie_proof: false
    });

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-11-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多