ModuleImport

Sam Tobin-Hochstadt samth at cs.indiana.edu
Thu Jun 19 11:32:29 PDT 2014


On Thu, Jun 19, 2014 at 2:29 PM, Chris Toshok <toshok at gmail.com> wrote:
>>>
>>> Calvin's suggestion would allow the following refactoring to be done by
>>> the module author without impacting his users, something not possible with
>>> current ES6:
>>>
>>> ```js
>>> // a.js V1
>>> export default { C: class C { ... } }
>>
>>
>> But this is the thing we are trying hard to have people never do.
>
>
> What exactly is it we're trying to have people do?  never export more than 1
> thing?  or never export an object literal, instead favoring
> Object.create(null, { })?

If people want to export a bunch of distinct things, each of which
should be addressed under a separate name, they should use named
exports. If they want to export a single abstraction, then they should
use default export. If they want to use both, then they should do
both. But if they want to export a bunch of named things, they don't
need to use default export for that.

Sam


More information about the es-discuss mailing list