Juan Ignacio Dopazo (2014-06-16T13:28:13.000Z)
>
>
>On Monday, June 16, 2014 12:33 AM, Axel Rauschmayer <axel at rauschma.de> 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.

Example:

// foo.js
export default function () { // anonymous function
  console.log(42);
}

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


Juan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140616/2ea2993b/attachment.html>
dignifiedquire at gmail.com (2014-06-17T18:17:37.561Z)
> On Monday, June 16, 2014 12:33 AM, Axel Rauschmayer <axel at rauschma.de> 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.

Example:
```js
// foo.js
export default function () { // anonymous function
  console.log(42);
}

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

Juan