google/closure-compiler

Allow language_out for ES2015, ES2016, etc.

Closed this issue · 2 comments

Currently ES5 is the most modern language_out available. This is problematic for a few reasons:

  • Some code cannot be correctly compiled to ES5. super() for example.
  • ES5 code can be more verbose, so file sizes will be larger in many cases.
  • ES5 equivalent is often slower.

I search for a similar issue but could not find one.

Duplicate of #949 and #950.

Some answers to the problems you listed:

  1. super() can be correctly transpiled in most cases, especially after recent commits by @brad4d.
  2. True.
  3. Not necessarily true. For example, last time I checked native for-of loops were often slower than our transpiled version that uses custom iterators. Of course, if we could transpile them to vanilla for loops it would be even faster. I have a work-in-progress for some of the cases.

Sorry, I promise I searched for other issues.

super() can be correctly transpiled in most cases

Yeah, but in some it cannot, such as extending HTMLElement. So if you need those cases you currently just can't use Closure.

But it sounds like you agree overall that this is a desirable feature. Thanks!