On 23 March 2012 21:59, Irakli Gozalishvili <[email protected]> wrote:

>
> A. ./foo.js ../foo/bar.js
> B. foo.js, foo/bar.js
>
> I'd suggest to resolve A type paths relative to a requirer (ether require
> module url, or document url). And resolve B
> type paths relative to a `document.baseURI`.
>

This is almost what CommonJS specifies and is quite close to what we use
locally.  We have a top-level path that is prepended to type B require
statements which is by default calculated from window.location.href.  We
can, of course, override it, in case we move the page to a location where
this calculation does not work -- exactly analogous to a <base href>
setting.

The fact that the modules themselves use relative paths to co-dependencies
means that it's easy to move modules around, from app to app, server to
server, etc.

One thing that would be nice that we don't currently have is the ability to
load modules relative to the calling web page.  This is an oversight in our
loader.

Wes

-- 
Wesley W. Garland
Director, Product Development
PageMail, Inc.
+1 613 542 2787 x 102
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to