Skip to content

Instantly share code, notes, and snippets.

@yoavweiss
Created September 10, 2026 12:36
Show Gist options
  • Select an option

  • Save yoavweiss/a54501545ab2ad22bfde0ebed02a115c to your computer and use it in GitHub Desktop.

Select an option

Save yoavweiss/a54501545ab2ad22bfde0ebed02a115c to your computer and use it in GitHub Desktop.
Avoid module loading explainer

Currently, HTML's fetch a single module script stored a permanent null entry in the module map whenever a module fetch failed. Because the module map is consulted before any module-related network activity, every later import() of that same (URL, module type) pair failed immediately, without a re-fetch, for the entire lifetime of the Document or worker.

That meant that a single transient failure was unrecoverable short of a full page reload (or a cache-busting URL such as import(url + "#retry1")).

This change removes entries from the module map upon network or status code failure (but not parse failure), enabling explicit developer-triggered retries (e.g. using import()) to take place.

There is no new API surface, only a behavior change.

This is only web exposed through the fact that previously-failed module fetches now issue a network request instead of immediately failing again.

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