Dorokhov.codes

01. Babel

Homepage: 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"
      }
    ]
  ]
}