ES6 modules (sorry...)

Axel Rauschmayer axel at
Sun Jun 15 20:32:54 PDT 2014

I apologize for this email, but I still don’t understand the current module design.

**Multi-export modules.** Modules made sense to me as long as they were maps from names to exported values:

// Module 'library'
export function foo() {
export function bar() {

// Module 'client1'
import { foo, bar } from 'library';

// Module 'client2'
import lib from 'library';;;

Compared to CommonJS, the syntax is nicer and less redundant. Additionally, the curly braces for getting stuff out of a module work, because they look like destructuring. And you get load-time errors if imports don’t match exports.

**Single-export modules.** Still missing is support for single-export modules, which could be added as follows (the keyword `default` instead of the asterisk works just as well, in my opinion).

// Module 'MyClass'
export* class {

// Module 'client3'
import* MyClass from 'MyClass';

At the moment, it seems to me like multi-export modules and single-export modules are mixed in a way that makes things difficult to understand.


Dr. Axel Rauschmayer
axel at

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list