Skip to content

Early hints and modulepreload #7854

@noamr

Description

@noamr

Currently in the spec, early hints work only for preload (and soon for preconnect).
In Chromium source code (as I understand it) and in WPT, modulepreload is also supported, but it's treated like a preload in the sense that it doesn't start loading module dependencies. It still uses the special fetching defaults/parameters of modulepreload like having script as the default for as.

I see how it's problematic to start creating actual script objects before the document is initialized, but it also changes the semantics of modulepreload when it's an early hint, which might be confusing - e.g. if the developer doesn't add an actual equivalent <link rel=modulepreload> to the document, the dependencies will only be fetched when the module is imported in practice.

I suggest the following strategy in the spec (and implementation):

  • Keep the existing Chromium behavior when the early hint headers are processed
  • Once the document is created, also preload the script graph immediately as if the document had a regular modulepreload header.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions