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

Support json/style as modulepreload destinations #10233

Open
noamr opened this issue Mar 29, 2024 · 6 comments
Open

Support json/style as modulepreload destinations #10233

noamr opened this issue Mar 29, 2024 · 6 comments

Comments

@noamr
Copy link
Contributor

noamr commented Mar 29, 2024

What is the issue with the HTML Standard?

json/css modules are available in import, however the modulepreload spec only allows script-like destinations (see https://html.spec.whatwg.org/multipage/links.html#link-type-modulepreload:link-type-modulepreload-3).

Allowing json/style here would allow preloading them for the purpose of imports.

@annevk
Copy link
Member

annevk commented Mar 30, 2024

Presumably they're already supported if they're deeper in the module graph. Just not as a top-level entry. I guess it makes sense to reuse the as attribute here?

cc @domenic @whatwg/modules

@noamr
Copy link
Contributor Author

noamr commented Mar 30, 2024

Presumably they're already supported if they're deeper in the module graph.

Right, in cases where modulepreload starts fetching the graph.

Just not as a top-level entry. I guess it makes sense to reuse the as attribute here?

Yes exactly, extend as to be script-like + json/style

cc @domenic @whatwg/modules

@noamr
Copy link
Contributor Author

noamr commented Mar 31, 2024

@nicolo-ribaudo WDYT?

@nicolo-ribaudo
Copy link
Contributor

This is a good change -- it should be possible to use modulepreload to load all the components of an ESM graph.

Currently modulepreload is a subset of preload, however there is no use case for preload as=json so it makes sense to only support JSON in modulepreload.

@noamr
Copy link
Contributor Author

noamr commented Apr 2, 2024

This is a good change -- it should be possible to use modulepreload to load all the components of an ESM graph.

Currently modulepreload is a subset of preload, however there is no use case for preload as=json so it makes sense to only support JSON in modulepreload.

It's sort-of a subset, it also populates the module map and uses crossorigin by default.

@nicolo-ribaudo
Copy link
Contributor

Yeah sorry, I meant "the possible resource types you can load with modulepreload are a subset of those you can load with preload".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants