Downleveling

Arrow functions

The arrow function is downleveled to a regular function when target is set to ES5.

Loading JavaScript...

Async and await

When target is ES5 or ES6 with lib set to ["es2015", "dom"], the transpiler will rewrite async functions to use generator functions and a helper.

This is transpiled to the following JavaScript code:

Loading JavaScript...

If you are facing issues with the compiled JavaScript, you may need to include regenerator-runtime from Facebook's regenerator compatibility compiler that this is based on.

Trade offs

Downleveling often creates a much larger output JavaScript file than if the program had been written in JavaScript to begin with. Some features are also less efficient when polyfilled, and certain features cannot be fully downleveled like proxies and top-level await.

Was this page helpful?