ES Modules: suggestions for improvement

Sam Tobin-Hochstadt samth at
Thu Jun 28 06:27:46 PDT 2012

On Wed, Jun 27, 2012 at 7:11 PM, James Burke <jrburke at> wrote:
> The use case: scripts, like jquery/backbone/others that want to live
> in a non-harmony and harmony world, I would expect that they could be
> adapted to call the System.set() API, but not use the new syntax
> keywords.

Ah, now I understand. Yes, this is feasible, and does *not* require
writing your own loader.  I'd write my forward-compatible
add_blaster.js like this:

    function g(n,m) { return n + m; };
    if (this.System) {
      System.set("add_blaster", {go : g});
    } else {
      this.add_blaster = { go : g };

Then, in a page, the client (on a browser that supports ES6) does this:

    <script src="/assets/add_blaster.js">
    module main {
      import go from "add_blaster";

sam th
samth at

More information about the es-discuss mailing list