terinjokes / gulp-uglify

Minify files with UglifyJS
MIT License
1.23k stars 154 forks source link

gulp-uglify can't handle async / await #358

Open etanb opened 5 years ago

etanb commented 5 years ago

We have a build that gets transpiled before hitting uglify(). Our code breaks with the following thrown error:

'Unexpected token: keyword «function», expected: punc «;»',

We've finally narrowed down that the usage of async and await broke uglify. Is there a fix for this?

terinjokes commented 5 years ago

There are some recommendations in this project's README. You can replace uglify-js with any other module that exports the same API.

etanb commented 5 years ago

I didn't see any, can you point me exactly where? Are there other ES6+ pieces of functionality that uglify chokes on?

terinjokes commented 5 years ago

I have looked at what they've done lately. I'd assume that pretty much anything other than const is going to cause issues.

https://github.com/terinjokes/gulp-uglify/blob/master/README.md#using-a-different-uglifyjs

etanb commented 5 years ago

Sorry if I'm being dense here, but how were you able to find what version of Javascript this version of uglify would support?

terinjokes commented 5 years ago

I don't recall, it's been several years since I added that section to the readme. My understanding is terser is the currently maintained fork with support for harmony features.

PRs to update the readme accepted.