module path resolution

David Bruant bruant.d at gmail.com
Fri Mar 23 17:36:46 PDT 2012


Le 23/03/2012 20:05, Irakli Gozalishvili a écrit :
> 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
I think that a behavior that would make sense could be:
1) If a script inserts a module, this script path (URL or file system
path or whatever) should be the base of relative module paths.
2) If the script has no path, let the platform decide of the behavior.
In the case of inline JavaScript in HTML, using the HTML base URL seems
appropriate (which depends on the base element if present).

> 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 ?
I would answer yes for inline scripts.

> 2. Are relative paths resolved to a requirer's url, owner html
> document's urlor baseURI ?
I would answer that if the requirer has a path, then this path should be
used. If it doesn't, it's platform dependent and in the case of HTML, it
would be the base document URL, which is dependent on the base element.

Does that make sense?

David


More information about the es-discuss mailing list