Rationale for dropping ModuleImport syntax?

Marius Gundersen gundersen at gmail.com
Mon Jun 9 14:01:35 PDT 2014

On Mon, Jun 9, 2014 at 7:40 PM, Karolis Narkevičius <karolis.n at gmail.com>

> Why can't we have both with the same syntax?
> ```js
> // imports a function which is the default export
> import mkdirp from "mkdirp";
> ```
> and
> ```js
> // imports all named exports, like module used to
> import fs from "fs";
> ```

According to the spec [1] (IIUC) you can import both all/some of the named
export values and the default export value, due to the second option of the

ImportClause :
  ImportedBinding , NamedImports

Does this mean that a module can export both a default value and several
named values? If so, libraries like Underscore would need to use both
namedExport and defaultExport to suite all users.
Or would the default value be an object containing all the named export
values? If so, it seems like your suggestion is already in the spec.

[1]: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-imports
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140609/685b3390/attachment.html>

More information about the es-discuss mailing list