>
>
>
> Because it doesn't allow for the Assignment Expression form (specifically,
> function expressions) that developers expect to be able to write:
>
>   export default function() {}
>

The alternative here is:

    function MyThing() {}
    export { MyThing as default };

Which is more clear, more readable, and barely less ergonomic.  If you
*really* want the AssignmentExpression form, you've got to put the equals
in there.  I've said this before, but without the equals it looks too much
like a declaration:

    export default class C {}
    var c = new C(); // No C defined, WTF?

Node users don't elide the equals sign, do they?

    module.exports = whateva;

So why are we?

Equals aside, let's look at the cost/benefit ratio here:

- Benefit: a little less typing (at most one savings per module)
- Cost: more confusion and StackOverflow questions about default export
syntax.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to