0

I'm trying to convert the following command:

uglifyjs src1.js src2.js -c -m toplevel --screw-ie8

to an API call:

ug.minify(['src1.js','src2.js'], {mangle:true, compress:true, ie_proof:false})

But I can't figure out how to set 'toplevel'. Setting toplevel:true or mangle:'toplevel' doesn't work.

Rob W
  • 315,396
  • 71
  • 752
  • 644
pixelmike
  • 1,751
  • 1
  • 15
  • 29

1 Answers1

2

Put the toplevel option within object literals:

require('uglify-js').minify(['src1.js','src2.js'], {
    mangle: {
        toplevel: true
    },
    compress: true,
    ie_proof: false
});
Rob W
  • 315,396
  • 71
  • 752
  • 644