Module naming and declarations

Claus Reinke claus.reinke at
Sat May 4 01:04:22 PDT 2013

> 0. No effort: modules are loaded relative to the document base url,
> with ".js" appended. So `import "jquery"` maps to the relative URL
> "jquery.js".
> 2. A few lines: you can use System.ondemand() to set the URL for each
> module you use. If you call
> `System.ondemand({"": "jquery"})`
> then `import "jquery"` maps to the URL you specified (imports for
> modules that aren't in the table will fall back on the loader's
> baseURL).

I think part of Andreas' concerns was that you now have a conflict
between 'import "jquery"' referring to a relative (0.) or registered (2.)
thing, because all names just look URL-ish. Another part was that
both times, the import may look URL-ish but doesn't behave like one.

Using something like 'import "registered:jquery"' for 2 would
remove the conflict, without changing the functionality. That would
still leave the implicit rewriting involved in 0 - perhaps one could
specify that every protocol-free name refers to a module (with
rewriting) and names with protocol prefixes refer to URLs?


More information about the es-discuss mailing list