> For the complete documentation index, see [llms.txt](https://michey85.gitbook.io/webpack/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://michey85.gitbook.io/webpack/babel.md).

# Babel

Базовые зависимости:

```
yarn add -D babel-loader @babel/core @babel/preset-env
```

Добавление транспиляции в конфиг вебпака:

```javascript
{
  module: {
    rules: [
       {
         test: /\.js$/,
         exclude: /node_modules/,
         use: {
           loader: "babel-loader" // этого достаточно, чтобы вебпак искал конфиг .babelrc || babel.config.js 
          }
       } 
    ]
  }
}
```

{% code title="babel.config.js" %}

```javascript
module.exports = {
    presets: ["@babel/preset-env"]
}
```

{% endcode %}
