ES6 modules (sorry...)

Juan Ignacio Dopazo jdopazo at
Mon Jun 16 06:28:13 PDT 2014

>On Monday, June 16, 2014 12:33 AM, Axel Rauschmayer <axel at> wrote:
>**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).

You're being confused by CommonJS. ES6 modules don't have "single-export modules". All modules can have multiple exports. And all modules can have a specially named export called "default" which allows you to skip the curly brackets.


// foo.js
export default function () { // anonymous function

// bar.js
import answer from 'foo'; // I can give whatever name I want to the default export
answer(); // 42

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

More information about the es-discuss mailing list