Reputation: 5293
Let's assume I have a folder with two files called ModuleA.js
and ModuleB.js
that looks like this:
ModuleA.js
export default {
someKey: 'Hello, world',
};
ModuleB.js
export const foo = 'bar';
export const another = 'variable';
Then I have an index.js
file that I would like to perform named export on those modules without writing the import
statement. I know how to do it with ModuleA
:
export { default as ModuleA } from './ModuleA';
But how can I import the name exports and export them in one line without writing e.g.?
import * as _ModuleB from './ModuleB'
export const ModuleB = _ModuleB;
Upvotes: 2
Views: 1452
Reputation: 138557
You can only reexport everything:
export * from "./ModuleB";
But you can't group that under a new namespace without importing & exporting. There is a proposal to change that.
Upvotes: 4