Skip to content Skip to sidebar Skip to footer

Can Javascript/typescript Re-export All Named Exports Under An Alias Without Importing First?

Is there any way to do something like the following? export * as MyAlias from 'path/to/somewhere'; I know it's possible to import everything first and then export it, but I would

Solution 1:

I would suggest you usage of named exports. It can be used like this:

import * asABCfrom'path/to/somewhere';
export { ABCasMyAlias };

There is second option that will work as expected:

import * asABCfrom'path/to/somewhere';
constMyAlias = ABC;

exportdefaultMyAlias;

Post a Comment for "Can Javascript/typescript Re-export All Named Exports Under An Alias Without Importing First?"