App root module specifiers
valentinium at gmail.com
Sun Jun 4 17:42:19 UTC 2017
I’m not entirely certain of this, but I don’t think that the semantics of
resolving a module specifier string are themselves a facet of the ES spec.
However, I think the issue you’re describing may already be addressed in
the implementations so far (Safari 10.1, Chrome Canary, FF Nightly) because
the paths are treated like any other URI and can therefore begin with "/".
So if we have a module at "www.host.foo/foo/foo.js" with the following
import bar from 'bar.js'
import baz from '/baz.js'
...then it looks for "www.host.foo/foo/bar.js" and "www.host.foo/baz.js".
I’m not sure if browsers are currently taking into account the `<base>`
element when doing this, but this is the behavior I’ve observed so far, and
it seems consistent with how other resource linking works in the browser
(e.g. imports in CSS files).
Node, which doesn't support `import` yet, maybe trained us a bit to see
module specifiers a different way. I’m not sure what the solution will end
up being there. The "/" is already taken to mean _system_ root rather than
package root I think, and paths without any slashes have special resolution
behavior that's nothing like URIs.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss