ES6, how can you export an imported module in a single line?

export {default as Module} from './Module/Module';

is the standard ES6 way, as long as you don’t need Module to also be available inside the module doing the exporting.

export Module from './Module/Module';

is a proposed ESnext way to do it, but that only works if you’ve enabled it in Babel for now.

Leave a Comment