Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import: URL clarification #149

Closed
guybedford opened this issue Jul 10, 2019 · 3 comments
Closed

import: URL clarification #149

guybedford opened this issue Jul 10, 2019 · 3 comments
Milestone

Comments

@guybedford
Copy link
Collaborator

guybedford commented Jul 10, 2019

The readme information on import: referrer handling is really excellent, but I just wanted to clarify one case for my own peace of mind which doesn't seem to be mentioned.

If I use an import: URL in a module specifier or dynamic import, will it still be resolved relative to the parent:

import x from 'import:x';
import y from 'x';
const z = await import('import:x');

// Are x,y, z all equal?

In addition, does that mean a dynamic import in a script would be script-relative:

<script src="/path/to/script.js"></script>

script.js

import('import:./dep.js'); // loads /path/to/dep.js?

I would hope that the answer to the above would be yes for consistency, but it doesn't seem to be explicitly detailed from what I could see.

@guybedford
Copy link
Collaborator Author

Perhaps the above shouldn't be supported actually, since we then have the question of import:x maps themselves!?

Either way would be good to know!

@domenic
Copy link
Collaborator

domenic commented Jul 10, 2019

Yeah, I guess we never did figure this out. The initial import maps rewrite had this as "TBD".

Making it fail certainly seems simplest. Maybe that would be a bit limiting, because you'll get a URL that sometimes you want to send to one place, and sometime send to import()?

I agree that if we were to allow it then we should basically just strip the leading import:.

@domenic domenic added this to the Full featured milestone Jul 10, 2019
@guybedford
Copy link
Collaborator Author

guybedford commented Jul 10, 2019 via email

@domenic domenic modified the milestones: Full featured, import: URLs Sep 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants