ModuleImport

Axel Rauschmayer axel at rauschma.de
Thu Jun 19 12:03:47 PDT 2014


> To me this is a bug not a feature; we should keep it simple and just have one way to get one import from one export.
> 
> Just to make a connection to the topic, Dave's intro says:
>    We've consistently seen confusion between the semantics of ModuleImport and default export.
> 
> For me this confusion lands on default export equally as 'module` import.

Personally, I agree, but many people feel strongly about the single-export use case. If default exports help with getting ES6 modules adopted more broadly then the slight increase in complexity is worth it.

Let’s compare. Your approach – slightly more redundant:

```js
// MyClass.js
export class MyClass { ... }
// main1.js
import { MyClass } from "MyClass";

// myFunc.js
export function myFunc(...) { ... }
// main2.js
import { myFunc } from "myFunc";
```

Default exports:

```js
// MyClass.js
export default class { ... };
// main1.js
import MyClass from "MyClass";

// myFunc.js
export default function (...) { ... };
// main2.js
import myFunc from "myFunc";
```

-- 
Dr. Axel Rauschmayer
axel at rauschma.de
rauschma.de



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140619/a5ea5967/attachment.html>


More information about the es-discuss mailing list