Widely available Useful when you know a module will be needed soon and want to reduce the gap before execution.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)

Syntax

HTML
<link rel="modulepreload" href="/js/app.js">
<link rel="modulepreload" href="/js/utils.js">
<script type="module" src="/js/app.js"></script>

Live demo

Module preload flow

Show how modulepreload can fetch a module graph before execution time.

PreviewFullscreen

When to use modulepreload

The cases where modulepreload shortens startup, and the trade-off worth measuring.

PreviewFullscreen

Preload comparison

Compare stylesheet preload, classic preload, and modulepreload at a glance.

PreviewFullscreen

Use cases

  • Critical app startup

    Preload entry modules that are certain to be needed during initial rendering.

  • Near-future navigation

    Warm module fetches for the next route or likely interaction path.

Cautions

  • Preloading too many modules can compete with other critical resources and reduce the benefit.
  • It works best when the preload choices are evidence-based rather than speculative everywhere.

Accessibility

  • Faster startup can improve perceived responsiveness, which benefits users who depend on a stable, prompt interface.