Module naming and declarations

Domenic Denicola domenic at
Wed May 8 10:03:57 PDT 2013

From: Jason Orendorff [jason.orendorff at]

> Here's what you would do under the proposal:
> ```js
> // import a module in the same package/project
> import "./controllers" as controllers;
> // import some other package
> import "backbone" as backbone;
> ```
> The surface syntax deliberately follows Node. The first import is relative and the second is absolute, within the tree of module names (not URLs; neither of those module names is a URL).

That is not my understanding of Sam's message at Following those steps for `"backbone"` would, according to that message,

1. Split the module name on "/", url-encode, and re-join (yielding `"backbone"`).
2. Append ".js" to the module name (yielding `"backbone.js"`).
3. Use the URL parser with the  base URL to produce an absolute URL (yielding `""`).
4. Pass the absolute URL to the fetch hook.

More information about the es-discuss mailing list