module path resolution
dherman at mozilla.com
Fri Mar 23 18:14:21 PDT 2012
On Mar 23, 2012, at 5:05 PM, Irakli Gozalishvili wrote:
> I'v being trying to figure out how ES.next module path resolution would work. Unfortunately proposal is not very clear about it: http://wiki.ecmascript.org/doku.php?id=harmony:modules
There's more info about the resolution semantics on the loaders page:
Basically loaders make it possible for programmers to create custom resolution policies.
But your question is probably more about what the default policy of the System loader will be on the web. First of all, the System loader's baseURL (should it be baseURI? I never understood the difference) would come from the document's URL. So relative would definitely be relative the HTML file.
> Here are some of the questions I have:
> 1. Will html [base element] have a same effect on modules as it has on script tags today ?
> 2. Are relative paths resolved to a requirer's url, owner html document's urlor baseURI ?
> If my assumptions are correct this little example is correct:
> [base element]:https://developer.mozilla.org/en/HTML/Element/base
These are really good points I hadn't thought about. Thanks for bringing it up! I like the idea that
forces the loading to be relative to the document, whereas
is interpreted as relative to the <base> path. I don't have strong feelings myself about what the System loader's policy should be on the web, but I want to make sure our infrastructure is flexible enough to support a) whatever everyone decides is the best policy for the browser, and b) policies like the Node.js / NPM policy. I will have to read up a little more on document.baseURI and <base> and all that.
Thanks for the information and ideas!
More information about the es-discuss