If I've got a .babelrc
file and a "babel"
field in package.json
, what happens?
Do the settings get merged? And which settings take precedence?
The docs don't say.
Babel will take setting in .babelrc as final over cli or any other source of config.
No merging of settings will occur either as babel will drop any previous settings when it encounters .babelrc
So when .babelrc is present only the settings contained in that file will be active.
Could you clarify your answer: Does this mean settings are merged and those in .babelrc take precedence?
No settings will be merged and the .babelrc settings will take precedence over everything else.
The exception to this however could occur when webpack is used since having babel as a loader with option babelrc: false,
will omit .babelrc setting from the webpack flow. This can be useful if there are other packages that rely on babel but are not necessery or compatible with webpack.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With