Module Default Export Syntax

Kevin Smith zenparsing at gmail.com
Sat Jun 21 08:47:09 PDT 2014


A couple of months ago, we discussed some issues with the default export
syntax, and Dave suggested making some minor tweaks so that these forms:

    export default function ...
    export default class ...

were declarations instead of expressions.

Has there been any movement on this issue recently?

I think this solution is acceptable, but I still maintain that it would be
less confusing for the user if we required an equal sign:

    export default = foo;

Consider the following case:

    export default { a: a1, b: b1 };

It would be easy for a beginner to misinterpret this as a shorthand for
multiple exports, when in fact this statement is exporting a single thing
which happens to be an object.

If the syntax were instead:

    export default = { a: a1, b: b2 };

such confusion is less likely.

Thanks!
Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140621/72aba96a/attachment.html>


More information about the es-discuss mailing list