allex's notebooks

  • uglify-js ie8 issus - /allex/uglify-js-ie8-issus
    Last edited 6 years ago
    var uglifyjs = require('uglify-js') var code = ` (function() { var foo = function Symbol() { return 'foo'; } if (typeof Symbol === "function" && Symbol.iterator) { console.log('bar') } console.log('...') function Foo() { if (!(this instanceof Foo)) throw new Error("constructor can't be called directly"); } window.Foo = Foo; }()) ` var minified = uglifyjs.minify(code, { ie8: true, output: { beautify: true } }).code console.log(minified) eval(minified)