Rationale for dropping ModuleImport syntax?

Axel Rauschmayer axel at rauschma.de
Sun Jun 8 23:39:00 PDT 2014

Context: https://gist.github.com/caridy/eefb9b104874465d4e1c#1-moduleimport-syntax-importdeclaration

module foo from "foo"; // drop this
import bar from "bar";

I’m seeing the following contra against dropping ModuleImport syntax:

> Contra: without a way to access the module object, it is difficult to deal with modules with many exports (e.g.: underscore), but we could fix this by using a reflective API to access imported modules

Isn’t this a frequent use case? Which would lead to ugly and very inconsistent code, especially if multiple imports are involved. I also don’t see how CommonJS-style modules could be neatly migrated to ES6 modules if this feature was dropped.

I do agree that the ModuleImport reads a bit strange, but that could be fixed, e.g. via a suggestion I’ve seen somewhere:

import module foo from "foo";

Dr. Axel Rauschmayer
axel at rauschma.de

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

More information about the es-discuss mailing list