4

Currently appears as UglifyJS2 and Google Closure doesn't support JavaScript minification of scripts including async/await usage without transpiling them.

Is there a way or another minifier to get these JavaScript scripts minified without the need to transpile them?

Felix Kling
  • 795,719
  • 175
  • 1,089
  • 1,143
Eghes
  • 95
  • 10
  • 2
    Just curious, why would you need to minify them if you can't use them in production anyway? – XCS Apr 05 '17 at 13:04
  • 2
    Because it's not true I can't use it in production. All main browsers support this specification ( http://caniuse.com/#search=await). Only Microsoft Edge on mobile devices will support this feature without the flag in the next version. Also NodeJS supports it. So for my requirements it's perfectly production ready. – Eghes Apr 05 '17 at 13:36

2 Answers2

3

UglifyJS introduced support for async/await in uglify-es@3.0.17 ( https://github.com/mishoo/UglifyJS2/issues/1789)

Eghes
  • 95
  • 10
-1

Not yet. Right now in order to minify the code you will need to transpile it first.

There is an open issue in UglifyJS2 repo - Harmony support #448:

You can track the progress of this issue. Hopefully the support will get added.

If you are willing to add the transpilation step then see this answer:

Community
  • 1
  • 1
rsp
  • 107,747
  • 29
  • 201
  • 177