ModuleImport

James Burke jrburke at gmail.com
Thu Jun 19 12:59:42 PDT 2014


On Thu, Jun 19, 2014 at 12:13 PM, Domenic Denicola
<domenic at domenicdenicola.com> wrote:
> From: es-discuss <es-discuss-bounces at mozilla.org> on behalf of James Burke <jrburke at gmail.com>
>
>> 1) Only allow export default or named exports, not both.
>
> As a modification of the current design, this hurts use cases like
>
> ```js
> import glob, { sync as syncGlob } from "glob";
> import _, { zip } from "underscore";
> ```

It is just as likely the module author will specify sync and zip as
properties of their respective default export. Particularly since
those are coming from JS modules that come from existing module
systems.

So a destructuring assignment would be needed, following the default
import. It works out though, and is not that much more typing. That,
or those pieces would be available as ‘underscore/zip’ or ‘glob/sync'
imports.

The argument for allowing both a default and named exports seems
ill-defined based on data points known so far, and by avoiding it, it
reduces the number of import forms and aligns better with
System.import use.

James


More information about the es-discuss mailing list