Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

URL inconsistency #87

Open
guybedford opened this issue Dec 28, 2013 · 3 comments
Open

URL inconsistency #87

guybedford opened this issue Dec 28, 2013 · 3 comments

Comments

@guybedford
Copy link

It is possible to do:

  System.import('http://some-site.com/script')

since import skips normalization, so there are no module name checks done.

But it is not possible to do:

<module>
  import 'http://some-site.com/script';
</module>

As the normalize function throws for URLs.

This should probably be made consistent - I would really strongly suggest having import run through normalization.

@jorendorff
Copy link
Owner

I'm a little confused because the built-in normalize function doesn't throw for URLs, or any other string. (Of course it's possible to override that to do whatever, but if you override it to throw for URLs, then complain that it throws for URLs, I'm not sure what we can do to fix that!)

System.import() skips normalization because normalization requires another input, the importing module's full name, which doesn't make sense in the context of System.import().

@guybedford
Copy link
Author

I suppose I should clarify, I'm referring to the browser loader here - https://github.com/jorendorff/js-loaders/blob/master/browser-loader.js#L108

http:// is seen as an empty segment throwing a TypeError.

Normalization still makes complete sense if parentName and parentAddress are null. It's just the difference between being at the top of the tree or not.

@johnjbarton
Copy link

"System.import() skips normalization because normalization requires another input, the importing module's full name, which doesn't make sense in the context of System.import()."

To me, the referrer for Loader.import() has to be the URL of the caller of import(). Otherwise relative names will not work out.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants