On Tue, May 7, 2013 at 11:48 AM, Sam Tobin-Hochstadt <[email protected]> wrote:
> On Tue, May 7, 2013 at 2:35 PM, Anne van Kesteren <[email protected]> wrote:
>> But you are treating them as URLs by default (with a small dose of magic).
>
> No.  This is not what's happening at all.
>
> Modules are given logical names, such a "backbone" or "jquery/ui".
> Module loaders map logical names to URLs and then map the URLs to
> JavaScript source.
>
> The default behavior of the initial module loader for the browser is
> to convert a logical name to a URL in a certain way, and then to fetch
> that URL with http in the usual way to get JS source.

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.


> The way we think that conversion should happen is to use the loader
> baseURL, which defaults to the document base URL, as a prefix, and
> ".js" as a suffix.  Certainly we could choose other prefixes instead,
> but it doesn't sound like you think there's a clear better choice.
> We could also choose a different suffix, or no suffix, but it would be
> odd to force everyone to remove the extensions on their files.

I think making them URLs (i.e. requiring import "/js/jquery.js") and
allowing people who want them to be something different to override
that with hooks is better. (Or with a new URL scheme as Kevin
suggests.)


--
http://annevankesteren.nl/
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to