Plugins

Out of the box Babel doesn't do anything. You need to use plugins to transform your code.

Don't know where to start? Check out some of our presets.

Presets

Don't want to assemble your own set of plugins? No problem! Presets are sharable .babelrc configs.

We've assembled some for common environments:

Many other community maintained presets are available on npm!

Stage-X (Experimental Presets)

Subject to change

These proposals are subject to change so use with extreme caution.

The TC39 categorises proposals into 4 stages:

To learn about the current stage of all proposals, check out https://github.com/tc39/ecma262#current-proposals.

To learn more about the TC39 Process, check out https://tc39.github.io/process-document.

Creating a Preset

To make your own preset, you just need to export a config.

// Presets can contain other presets, and plugins with options.
module.exports = {
  presets: [
    require('babel-preset-es2015'),
  ],
  plugins: [
    [require('babel-plugin-transform-es2015-template-literals'), { spec: true }],
    require('babel-plugin-transform-es3-member-expression-literals'),
  ],
};

For more info, check out the babel handbook section on presets or just look at the es2015 preset repo as an example.

Transform Plugins

These plugins apply transformations to your code.

Transform plugins will enable the corresponding syntax plugin so you don't have to specify both.

ES3

ES5

ES2015

Modules

Experimental

Minification

React

Other

Misc Plugins

Syntax Plugins

These plugins allow Babel to parse specific types of syntax.

Plugin Options

Plugins can specify options. You can do so in your config by wrapping it in an array and providing a options object. For example:

{
  "plugins": [
    ["transform-async-to-module-method", {
      "module": "bluebird",
      "method": "coroutine"
    }]
  ]
}

Plugin Development

Please refer to the excellent babel-handbook to learn how to create your own plugins.