I get the error Multiple default exports when trying to export everything from another file including the default export e.g.
export * from './foo';
export { default as default } from './foo';
It looks like that this case should throw an error (as shown by this test case) however babel compiles the code export * from './foo'; to:
Object.keys(_foo).forEach(function (key) {
if (key === "default") return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _foo[key];
}
});
});
Reference
so the second export is necessary to ensure the default export also gets exported.
Any suggestions? I'm not sure whether it's actually babel which is at fault here or if the assumption in this plugin is wrong. Happy to contribute a PR if a solution is agreed on.
I get the error
Multiple default exportswhen trying to export everything from another file including the default export e.g.It looks like that this case should throw an error (as shown by this test case) however babel compiles the code
export * from './foo';to:Reference
so the second export is necessary to ensure the default export also gets exported.
Any suggestions? I'm not sure whether it's actually babel which is at fault here or if the assumption in this plugin is wrong. Happy to contribute a PR if a solution is agreed on.