blendid
blendid copied to clipboard
Move babel config to a .babelrc file
Other packages like Jest expect this file to exist if you're using babel. This would make sharing babel settings easier.
This miiiiiight already work. I think .babelrc
files trump the config if they exist. Need to test further though.
I confirmed that from a small testing project, using .babelrc
seemed to have work wonderfully.
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.