Calvin Metcalf calvin.metcalf at
Wed Jun 25 03:43:29 PDT 2014

Thanks Kevin.

Back to bikeshedding import export syntax.

The refactoring hazards of defaulting to an object with all the exports are
going to depend on how the feature is described, talking in terms of
looking first for a default export and then returning the module body and
now you get unforseen changes when you add an export named default.

But if modules were said to have a default default export that was an
object with all the exports that could be overridden then that's different.

Adding an export named default and the import changed is unexpected,
overriding the default export and the default import changed, on the other
hand, is not unexpected behavior.
On Jun 24, 2014 10:48 PM, "Kevin Smith" <zenparsing at> wrote:

> Side note: is that legal?  I assumed you wouldn't be able to do that due
>> to default being a reserved word.
> Definitely.  Exports can be named any IdentifierName, so all of this is
> valid:
>     export { foo as class, bar as switch, baz as default };
> And you can import IdentifierNames as well:
>     import { class as foo, switch as bar, default as baz } from "wherever";
> **Here's the crucial point:**
> In fact, the default export is nothing other than an export named
> "default".  These two import declarations are *entirely* equivalent:
>     import { default as whatever } from "module";
>     import whatever from "module";
> Does that make sense?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list