A question about Loader baseURL

Sam Tobin-Hochstadt samth at ccs.neu.edu
Tue Aug 28 04:44:24 PDT 2012


On Mon, Aug 27, 2012 at 11:38 PM, Shijun He <hax.sfo at gmail.com> wrote:
> Example:
>
> == my.js ==
>
> var myLoader = new Loader(System, {fetch: myFetch}
> function myFetch(relURL, baseURL, ...) {...}
>
> myLoader.load('a/a.js', ...)
>
>
> == a/a.js ==
> import x from 'a/a.js' // developer means to load a/a/a.js
> ...

Right, and the sensible way to combine the baseURL
'http://example.com/a/a.js' and the relURL 'a/a.js' is to produce
'http://example.com/a/a/a.js', which is exactly what you want in this
case.

> As I understand, imports in a/a.js (what in this case also import
> another 'a/a.js' which should be resolve to 'a/a/a.js') will also
> delegate to myLoader,

Exactly.

> so it is obviously wrong if myFetch is invoked
> with two identical arguments.

I don't see why that's wrong at all.
-- 
sam th
samth at ccs.neu.edu


More information about the es-discuss mailing list