Closed runlevel5 closed 6 years ago
ES6 support in uglifyjs is still more or less experimental and not enabled by default in Uglifier. Uglifier.new(harmony: true).compile("for (var value of myArray) { console.log(value) }")
works.
Any thoughts about supporting uglify-es? I have not come across a Gem that wraps it yet...
Yes, you can use uglify-es. The option is named harmony
, which is slightly inconvenient. At least I wasn't aware at the time that there would be a long-running separate package with name uglify-js at the time when that was added to Uglifier.
This should work:
Uglifier.new(harmony: true).compile("for (var value of myArray) { console.log(value) }")
It seems to me ES6
for-of
is not correctly parsed.Wondering if others experience same issue.