ModuleImport

Kevin Smith zenparsing at gmail.com
Tue Jun 24 19:48:07 PDT 2014


> 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: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140624/d13a136a/attachment.html>


More information about the es-discuss mailing list