ES6 module syntax: is it possible to `export * as Name from …`?

No, it’s not allowed in JS either, however there is a proposal to add it. For now, just use the two-step process with importing into a local variable and exporting that:

// file: constants.js
export const SomeConstant1 = 'yay';
export const SomeConstant2 = 'yayayaya';

// file: index.js
import * as Constants from './constants.js';
export {Constants};

Leave a Comment