Module naming and declarations

Jason Orendorff jason.orendorff at
Fri May 3 16:46:56 PDT 2013

On Thu, May 2, 2013 at 9:47 AM, Andreas Rossberg <rossberg at> wrote:
> I don't see how logical names can possibly make sense without at least
> a rudimentary manager that maps them. Otherwise they are just physical
> names.

Yes. A rudimentary way of mapping logical names to URLs is built into
the proposal: the default resolve behavior.

0. No effort: modules are loaded relative to the document base url,
with ".js" appended. So `import "jquery"` maps to the relative URL

1. One line of code: you can set the root URL from which all imports
are resolved. If you set `System.baseURL =
""` then `import "jquery"` maps to the URL

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

3. Beyond that: write a resolve hook and locate modules however you want.


More information about the es-discuss mailing list