babel/doc/polyfill.md
Sebastian McKenzie fa71f2a7f9 Merge branch 'core-js' into 2.0.0
Conflicts:
	lib/6to5/polyfill.js
2014-12-25 14:27:29 +11:00

966 B

Polyfill

6to5 includes a polyfill that includes a custom regenerator runtime and core.js.

This will emulate a full ES6 environment. This polyfill is automatically loaded when using 6to5-node and 6to5/register.

Usage

Node/Browserify

You need to include the polyfill require at the top the entry point to your application.

require("6to5/polyfill");

Fortunately, this is automatically loaded when using:

require("6to5/register");

Browser

Available from the browser-polyfill.js file within the 6to5 directory of an npm release. This needs to be included before all your compiled 6to5 code. You can either prepend it to your compiled code or include it in a <script> before it.

NOTE: Do not require this via browserify etc, use 6to5/polyfill.