jorendorff / js-loaders

Pseudoimplementation of the proposed ES6 module loaders.
54 stars 7 forks source link

default resolve behavior vs common-sense URL's #7

Closed dherman closed 11 years ago

dherman commented 11 years ago

Again suppose we have loaded a module "a/b/c" from the url "http://example.com/scripts/a/b/c.js", and it contains

import "x" as x;

The system loader's default resolve behavior produces the full name "x" and the url "http://example.com/scripts/a/b/x.js". That can't be right.

dherman commented 11 years ago

The default normalize behavior produces the full name "x", and then the default resolve behavior produces baseURL + "x" + ".js", IOW, "http://example.com/scripts/x.js".

Dave

samth commented 11 years ago

Note that to get the URL @jorendorff was thinking of you could do:

import "./x" as x;
jorendorff commented 11 years ago

Makes perfect sense.