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
- Use babel-polyfill: add it to your project (
-
For libraries
- Use transform-runtime instead:
yarn add --dev babel-plugin-transform-runtime yarn add babel-runtime
- Use transform-runtime instead:
-
Using Babel with Node.js
-
Get the version of node you have installed
node --version
-
Install babel-cli and the appropriate preset
npm install --save-dev babel-cli babel-preset-node8
-
Update your package.json to call babel-node instead of node
"scripts": { "start": "babel-node . --presets node8",