Skip to content

fetch a single module script always defaults to javascript modules for top level fetches #12214

Description

@Gae24

What is the issue with the HTML Standard?

I noticed this inconsistency while working on modulepreload support for Servo.
Inside fetch a single module script the default value of moduleType is javascript-or-wasm, which can be overridden by performing module type from module request with the optional argument moduleRequest.

Essentially it is expected that JSON and CSS module scripts can only be fetched if they are descendants of a javascript module, which is no longer the case with #11981.

Activity

  1. annevk commented on Mar 2, 2026

    @annevk
    Member

    @KurtCattiSchmidt @noamr can you take a look at this?

  2. KurtCattiSchmidt commented on Mar 2, 2026

    @KurtCattiSchmidt
    Contributor

    Doesn't https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-modulepreload-module-script-graph already handle this? The original script fetch was already outside of a module for script preloads prior to #11981.

    The default "javascript-or-wasm" shouldn't matter due to module type from module request.

    Note that JSON and style modules are always leaf nodes currently, so they can't fetch other modules.

  3. annevk commented on Mar 2, 2026

    @annevk
    Member

    But moduleRequest isn't an argument that's given.

    (The way it still passes onComplete despite that not being a named parameter is also broken, but that should probably be fixed separately.)

  4. reopened this on Mar 2, 2026
  5. KurtCattiSchmidt commented on Mar 3, 2026

    @KurtCattiSchmidt
    Contributor

    Attempting to address this here: #12223

    I'm not positive it's the correct approach, so let me know if I'm off base. The "module type from fetch destination" part feels a little strange.

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