I have a react module boilerplate which makes use of rollup, and some users are requesting the ability to export multiple components.
I'm bundling to cjs and es formats (rollup.config.js), so including both named and default exports from my bundle should be fine as I understand it, but rollup prints a warning about the use of mixed default and named exports.
import Foo from './Foo'
import Bar from './Bar'
// export Foo and Bar as named exports
export { Foo, Bar }
// alternative, more concise syntax for named exports
// export { default as Foo } from './Foo'
// you could also export a default object containing your module's interface
// note that if you export both named and default exports, rollup will complain.
// if you know how to prevent this warning, please let me know :)
// export default { Foo, Bar }
For more context, see this thread.
In particular, I can see why this would be a problem for umd bundles (source), but I'm not sure why rollup is complaining for es and cjs bundles.
Any idea how we could resolve this issue?
I have a react module boilerplate which makes use of rollup, and some users are requesting the ability to export multiple components.
I'm bundling to
cjsandesformats (rollup.config.js), so including both named and default exports from my bundle should be fine as I understand it, but rollup prints a warning about the use of mixed default and named exports.For more context, see this thread.
In particular, I can see why this would be a problem for
umdbundles (source), but I'm not sure why rollup is complaining foresandcjsbundles.Any idea how we could resolve this issue?