On Tue, May 7, 2013 at 4:33 PM, Anne van Kesteren <[email protected]> wrote: > On Tue, May 7, 2013 at 1:22 PM, Sam Tobin-Hochstadt <[email protected]> wrote: >> On Tue, May 7, 2013 at 4:01 PM, Anne van Kesteren <[email protected]> wrote: >>> How is that not treating it as a URL with a dose of magic by default? >>> E.g. import "http://code.jquery.com/jquery-1.9.1.min" will work given >>> the way things are defined now. Similarly if I put jquery in root >>> import "/jquery-1.9.1.min" will always work, regardless of location. >>> This might not be how things are intended to be used, but I'd expect >>> to see this kind of usage. >> >> Using an absolute URL (as in your first example) opts out of any >> processing. Otherwise it wouldn't work, of course -- adding the >> baseURL would break that URL. > > "Adding"? What's the actual processing model for the default loader > here? I thought it was: > > 1. Append ".js" to module name. > 2. Use the URL parser to parse module name relative to base URL. > 3. Fetch result of that operation.
The actual processing model is: 1. Produce a string that is, roughly, System.baseURL + moduleName + ".js". 2. Pass that to the fetch hook (which by default fetches that URL). >> In the second case, what is the complain? That's a reasonable module name. > > If that's reasonable you might as well not add ".js" by default and > require that to be specified if people want that. (Tying file > extensions to content is dubious in a web context in general.) It's reasonable in the sense that we aren't disallowing it. It's a bad idea because it's bad for coordination. >> The whole point of my original email to Andreas is that this doesn't >> work. These names are *not* intended to specify where to find the >> resource. They *are* intended to be names that different modules can >> coordinate with. Should backbone put `import "/js/jquery.js"` in >> their source file? > > If backbone has its own loader and everything it doesn't really matter > what the default semantics are. I no longer know what you're talking about. Why would backbone have it's own loader? If you're using a page with multiple libraries that depend on jquery, you need a way for them all to use the same jquery. That's the point of giving it a well-known name, like "jquery". This is similar to the way you'd use AMD for this. Please go back and read the email I mentioned. Sam _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

