abagshaw/brackets-minifier

ES6 "for..of" not supported?

Closed this issue · 3 comments

I get the following error when I use the ES6 for..of construct:
Unexpected token name «of», expected punc «;»

E.g.:
for ( var k of array ) ...

Unfortunately UglifyJS3 does not natively support ES6. You may be able to get ES6 minification working with brackets-minifier by following the steps I outlined here.

Thanks Andrew - you might want to mention this in the description.

@mblais No problem. Good point - I might add a note on the readme. If you do try the steps I outlined let me know if they work for you.

I'm guessing that the UglifyJS authors have chosen to put their ES6 minification tool in a separate package because it's less stable than their regular minification tool that only supports up to ES5 (I could be wrong about that though). That's why I've chosen to stick with the default UglifyJS package for this plugin (to avoid introducing more problems for those who just use this for < ES6 minification).

Hopefully they will roll ES6 support into their main package soon.