babel/doc/caveats.md

1.4 KiB

Caveats

Async/Generators

The regenerator runtime and an ES6 polyfill are required in order for generators to work.

Async/Comprehensions

Experimental support must be enabled for these proposed ES7 features to work.

Array comprehension/Array destructuring/Spread

An ES6 polyfill is required. More specifically a polyfill for Array.from.

Classes

Built-in classes such as Date, Array and DOM cannot be subclassed due to limitations in ES5 implementations.

If you're inheriting from a class then static properties are inherited from it via __proto__, this is widely supported but you may run into problems with much older browsers.

NOTE: __proto__ is not supported on IE <= 9 so static properties will not be inherited. A possible workaround is to use super();:

class Foo {
  static foo() {

  }
}

class Bar extends Foo {
  static foo() {
    super();
  }
}

Constructor spread

Constructor spreads do not currently support built-ins. ie. new Array(...items).

For-of

A polyfill is required for for-of functionality that implements Symbol and adds prototype[Symbol.iterator] behaviour to built-ins. Using the polyfills specified in polyfill suffices.