rollup / rollup-plugin-babel

This package has moved and is now available at @rollup/plugin-babel / https://github.com/rollup/plugins/tree/master/packages/babel
MIT License
702 stars 87 forks source link

How is Babel configured between its own config file and the options passed to the Rollup plugin? #338

Closed mario-d-s closed 4 years ago

mario-d-s commented 4 years ago

Hi,

I searched the issue tracker for explanation but failed to find any. To me the following is not explained properly in the readme/doc. It just says that Babel will respect any .babelrc or babel.config.js* file, but what does the final config look like?

For example, if we have in .babelrc:

"plugins": ["@babel/proposal-decorators"]

And the object returned from rollup.config.js contains this:

plugins: [
    babel({ plugins: ['@babel/proposal-class-properties'] })
]

Are the configs merged and do both plugins get applied? If yes, in what order, because that is also important?

Andarist commented 4 years ago

I’m actually not sure about the order - I would assume options passed to this plugin would be put after config items, but that is a guess.

We don’t do anything special in this regard - we just hand options to Babel so it takes care of this stuff. This should be explained here https://babeljs.io/docs/en/options#merging but seems it isn’t. Maybe worth reporting to Babel?

Andarist commented 4 years ago

Going to close this as the issue has been reported to Babel.