arrow_back
Back

Babel: JavaScript transpiling, presets, env, and polyfills

Andrew Dorokhov Andrew Dorokhov schedule 1 min read
menu_book Table of Contents

Homepage: open_in_new https://babeljs.io

Babel is a popular JavaScript compiler that allows developers to write code using the latest ECMAScript (JavaScript) features and then transform it into equivalent code that can run in environments that may not support those features natively.

Installation

npm install --save-dev @babel/core @babel/cli @babel/preset-env

Adding polyfills

npm install --save @babel/polyfill

We need to create a config file babel.config.json:

{
  "presets": [
    [
      "@babel/preset-env",
      {
        "targets": {
          "edge": "17",
          "firefox": "60",
          "chrome": "67",
          "safari": "11.1"
        },
        "useBuiltIns": "usage",
        "corejs": "3.6.5"
      }
    ]
  ]
}
code

Need Help with Development?

Happy to help — reach out via the contacts or go straight to my Upwork profile.

work View Upwork Profile arrow_forward
Next Article

CSS Flexbox: alignment, flex properties, and responsive layouts

arrow_forward