How to use the babelrc

All Babel API options except the callbacks are allowed (because .babelrc files are serializable JSON).


  "plugins": ["transform-react-jsx"],
  "ignore": [

Use via package.json

You can alternatively choose to specify your .babelrc config from within package.json like so:

  "name": "my-package",
  "version": "1.0.0",
  "babel": {
    // my babel config here

env option

You can use the env option to set specific options when in a certain environment:

  "env": {
    "production": {
      "plugins": ["transform-react-constant-elements"]

Options specific to a certain environment are merged into and overwrite non-env specific options.

The env key will be taken from process.env.BABEL_ENV, when this is not available then it uses process.env.NODE_ENV if even that is not available then it defaults to "development".

You can set this environment variable with the following:


# at the start of a command

# or as a separate command
$ NODE_ENV=production


$ SET BABEL_ENV=production

Lookup behavior

Babel will look for a .babelrc in the current directory of the file being transpiled. If one does not exist, it will travel up the directory tree until it finds either a .babelrc, or a package.json with a "babel": {} hash within.