liveBook · Manning

.babelrc

As explained in Get Programming with JavaScript Next: New features of ECMAScript 2015, 2016, and beyond

A Babel configuration file, typically placed in a project root and written as JSON to specify Babel settings.

When Babel 6 needs to transform code, put a valid JSON configuration file named .babelrc in the project root. Babel 6 applies no transformations by default, so install the presets or plugins you want and specify them in the configuration. section 2.2

{
  "presets": ["es2015"]
}

This minimal configuration selects the ES2015 preset; install the preset in the project as well. section 2.2

Listing 2.2. Babel stage-0 presets
{ "presets": ["es2015", "stage-0"], "plugins": ["transform-decorators-legacy"], "sourceMaps": "inline" }

This expanded example adds stage-0 features, a legacy decorators plugin, and inline source maps. Stage-0 includes existing proposed features; install the listed presets and plugin. section 2.3

How Get Programming with JavaScript Next: New features of ECMAScript 2015, 2016, and beyond covers it

How deep it goes
Specifies project-root placement and valid JSON, then demonstrates preset, plugin, and inline source-map settings.
Examples
Shows ES2015-only and stage-0 configurations, including legacy decorators and inline source maps.
What you can do after
Configure Babel 6 to transpile ES2015 or proposed features and include inline source maps.
How it connects
Connects Babel configuration to presets, plugins, source maps, and npm scripts.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Get Programming with JavaScript Next: New features of ECMAScript 2015, 2016, and beyond. The section links point to the parts of the book it draws on.