Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Move babel config to a .babelrc file #380

Open
greypants opened this issue Jan 23, 2017 · 3 comments
Open

Move babel config to a .babelrc file #380

greypants opened this issue Jan 23, 2017 · 3 comments

Comments

@greypants
Copy link
Contributor

Other packages like Jest expect this file to exist if you're using babel. This would make sharing babel settings easier.

@greypants
Copy link
Contributor Author

This miiiiiight already work. I think .babelrc files trump the config if they exist. Need to test further though.

@maoueh
Copy link
Contributor

maoueh commented Jun 4, 2017

I confirmed that from a small testing project, using .babelrc seemed to have work wonderfully.

@maoueh
Copy link
Contributor

maoueh commented Jun 5, 2017

After further testing, it appears that not everything is picked up. It seems that plugins does not work when used inside the .babelrc file.

In .babelrc, this was not working:

$ cat .babelrc
{
  "presets": ["react-app"],
  "plugins": ["transform-decorators-legacy"]
}

While this is working:

  javascripts: {
    entry: {
      app: ['./app.js'],
    },
    babel: {
      presets: ['react-app'],
      plugins: ['transform-decorators-legacy'],
    },
  },

Also, I tested to see what would happen if I mixed stuff. This test seems to point there is some kind of merging happening as this setup is also working correctly:

$ cat .babelrc
{
  "presets": ["react-app"]
}
  javascripts: {
    entry: {
      app: ['./app.js'],
    },
    babel: {
      plugins: ['transform-decorators-legacy'],
    },
  },

So the presets and plugins were merged in a single config but specifying plugins in .babelrc does not seem to work as expected.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants