Skip to content

Support json/style as modulepreload destinations #10233

Description

@noamr

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.

Activity

  1. annevk commented on Mar 30, 2024

    @annevk
    Member

    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

  2. noamr commented on Mar 30, 2024

    @noamr
    ContributorAuthor

    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

  3. noamr commented on Mar 31, 2024

    @noamr
    ContributorAuthor
  4. nicolo-ribaudo commented on Apr 2, 2024

    @nicolo-ribaudo
    Member

    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.

  5. noamr commented on Apr 2, 2024

    @noamr
    ContributorAuthor

    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.

  6. nicolo-ribaudo commented on Apr 2, 2024

    @nicolo-ribaudo
    Member

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

  7. added
    agenda+To be discussed at a triage meeting
    and removed
    agenda+To be discussed at a triage meeting
    on Dec 4, 2025
  8. added a commit that references this issue on Jan 31, 2026
    762589c
  9. added a commit that references this issue on Mar 31, 2026
    6d1879f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions