-
Notifications
You must be signed in to change notification settings - Fork 26
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
"the type attribute is used simply for a check" #43
Comments
That text was written with |
How about this: If we go with a key-value syntax, like import json from "./foo.json" with type: "json" then we would say, "the type attribute is a check, but other attributes may change interpretation." This way, import jsText from "./module.js" with reading: "text" |
Overall, I think this thread vindicates the decision to go with key/value syntax, rather than a single |
This issue is a bit outdated. Since we decided to only allow "check" attributes and the key value form. The type attribute is not part of the cache. So import jsText from './module.js' as 'text'; is now disallowed if module is of type JavaScript. @jakearchibald we are discussing (whatwg/html#5640) if the host should send an |
The proposal has now been updated to that import attributes are more than just a check, and hosts can use them to affect how a module is loaded/evaluated (for example, by sending different HTTP headers when loading it). How modules with different attributes are handled in the HTTP cache is up to the host, since the host defines what the different attributes means. However, the proposal requires that if the same specifier is imported from the same module with the same attributes twice it must then result in the same module. |
Can you give a bit more detail around this? From the readme it still looks like a check https://github.com/tc39/proposal-import-assertions/blob/master/README.md. It's still called an "assert" too. |
From the readme:
This suggests you couldn't do something like:
I agree these should coalesce at the fetch & HTTP cache level, but they should be different modules.
The text was updated successfully, but these errors were encountered: