module exports

C. Scott Ananian ecmascript at cscott.net
Fri Mar 14 09:00:58 PDT 2014


Sigh.  The example just better demonstrates how clunky the syntax is
and how surprising the semantics can be. :(

<rant>
I hope one of the CommonJS or RequireJS folks write a good ES6 module
loader so that I can continue to use reasonable syntax and ignore all
of this.

This really smells like Second System Syndrome.  The module spec is
trying to do too much.  *Both* module objects *and* mutable bindings.
*Both* defaults *and* named exports.

There is a certain elegance to the way both RequireJS and CommonJS
reuse fundamental JavaScript patterns (assignment,
functions-with-arguments, objects-with-properties).  The `gjs` module
system was even smaller, with a single "magic" `imports` object.  I
really wish the ES6 module system could be chopped down to clearly
express a single idea, and do more with less.
</rant>
  --scott


More information about the es-discuss mailing list