Module naming and declarations

Domenic Denicola domenic at domenicdenicola.com
Wed May 8 11:08:04 PDT 2013


From: samth0 at gmail.com [samth0 at gmail.com] on behalf of Sam Tobin-Hochstadt [samth at ccs.neu.edu]

> How is this in disagreement with what Jason said?  His point is that if you're in the module "a/b/c", "./controllers" refers to "a/b/controllers", and "backbone" refers to "backbone".

Ah, I see, there are two levels of translation! First from "non-canonical module IDs" to "canonical module IDs", which in this case means from `"./controllers"` to `"a/b/controllers"`, and then another from "canonical module IDs" to URLs. It's confusing since there are two concepts of "base" in play: the current module's "canonical module ID" is used as a "base" when resolving "non-canonical module IDs", and the base URL is used when resolving "canonical module IDs" to URLs.

(Sorry for the heavy use of scare-quotes, but I wanted to make it clear I don't know the right names for things and am open to correction.)

But, even then, that seems at least somewhat at odds with what Jason said. He implied that `"backbone"` would resolve to the backbone package, and not to the URL `"http://example.com/path/to/base/backbone.js"`. In particular, he contrasted "some other package" (Backbone) with "a module in the same package/project," which to me would be modules under `"http://example.com/path/to/base/"`. I look forward to finding out which part I misunderstood :).


More information about the es-discuss mailing list