terinjokes/gulp-uglify

gulp-uglify can't handle async / await

etanb opened this issue · 5 comments

etanb commented

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?

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

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

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

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

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.