Do Anonymous Exports Solve the Backwards Compatibility Problem?

Kevin Smith khs4473 at gmail.com
Wed Dec 19 13:27:54 PST 2012


> In summary, I do not believe there is a technical issue with export
> assignment and backcompat, which was the what started this thread.


Why not?  I've attempted to show that it's not possible to correctly use
this feature for backward compatibility without parsing the code first.
 Pre-parsing everything at runtime isn't practical.  Therefore, using this
feature for backward compatibility at runtime isn't practical.

Of course, you could use other ad hoc methods to tell the loader not to
apply the `export =` trick, but then you'd be layering tricks upon tricks.

I think the best migration strategy for Node will be to use `require` for
Node-style modules, and to use import syntax for ES6 modules.  Node needs
to modify it's URL resolution rules for ES6 modules anyway.  : )

For the web, the answer is transcompilation from ES6 to ES5, using
CommonJS-style function wrappers to emulate modules.

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


More information about the es-discuss mailing list