-
Notifications
You must be signed in to change notification settings - Fork 72
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
Speculative parser and dynamic import maps #234
Comments
Hmm, that'd be pretty surprising. Bare specifiers like What would alleviate the concern here? A section spelling out how speculative parsers currently could work, and explaining how import maps change them? |
The concern is with dynamic import maps and specifiers that are treated as relative URLs. You're right that |
Wouldn't this speculative parser already break today with patterns like this: <!DOCTYPE html>
<html>
<head></head>
<body>
<script>
const base = document.createElement('base');
base.href = '/base/';
document.head.appendChild(base);
</script>
<script type="module">
import './foo.js';
</script>
</body>
</html> |
@LarsDenBakker that's a good point, and I think you are right. I'd be curious if @annevk sees something we might be missing though. Regardless, it speaks toward how it'd be a good idea to document the pitfalls of doing speculative parsing of JS module specifiers. Maybe formally as part of whatwg/html#5959, and informally in a section in this repo's explainer? |
Inserting a I'm not sure why that would be a pitfall for JS module specifiers though. |
For https://github.com/WICG/import-maps#dynamic-import-map-example it seems that a good speculative parser might also fetch
my-library
(parsed with the relevant base URL). This risk seems worth highlighting.This also relates to #218.
The text was updated successfully, but these errors were encountered: