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
  • 341,306
  • 83
  • 791
  • 678
pixelmike
  • 1,973
  • 1
  • 19
  • 31

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
  • 341,306
  • 83
  • 791
  • 678