Babel

Archived

This page has been archived and will receive no further updates.

Compiling

  • Certain features require polyfills. See here for the exact list: https://babeljs.io/docs/usage/caveats/#polyfills

  • In order to get this functionality, you have several options:

    • For applications

      • Use babel-polyfill: add it to your project (yarn add babel-polyfill) and include it before all other code
    • For libraries

      • Use transform-runtime instead:
        yarn add --dev babel-plugin-transform-runtime
        yarn add babel-runtime
        

Using Babel with Node.js

  1. Get the version of node you have installed

    node --version
    
  2. Install babel-cli and the appropriate preset

    npm install --save-dev babel-cli babel-preset-node8
    
  3. Update your package.json to call babel-node instead of node

      "scripts": {
        "start": "babel-node . --presets node8",