← All notes

Vite provides a Hot Module Replacement API over native ESM

Answer: At a basic level, developing with Vite is not that different from using a static file server. Vite then adds enhancements over native ESM imports that you usually see in bundler-based setups.

One of those enhancements is Hot Module Replacement. Vite provides an HMR API over native ESM. Frameworks with HMR can use that API to apply precise updates without reloading the page or dropping application state. Vite ships first-party HMR integrations for Vue Single File Components and React Fast Refresh. There is also an official Preact integration.

Vite also rewrites bare module imports to valid URLs the browser can load, and it pre-bundles dependencies to speed up page load and to convert CommonJS or UMD modules to ESM.

In source

handleHMRUpdate is the server function that handles create, delete, and update events for a file on a ViteDevServer.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources and notices: Vite documentation and source (vitejs/vite): Copyright (c) 2019-present, VoidZero Inc. and Vite contributors; MIT (https://raw.githubusercontent.com/vitejs/vite/main/LICENSE). Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Vite docs and Vite source (vitejs/vite), MIT. Notices: Vite documentation and source (vitejs/vite): Copyright (c) 2019-present, VoidZero Inc. and Vite contributors; MIT (https://raw.githubusercontent.com/vitejs/vite/main/LICENSE).

Cite this

Permanent ID: iil:note:qr958d39

iinventedlight. 2026. "Vite HMR updates modules over native ESM without a full reload." iinventedlight Library, iil:note:qr958d39, version of 2026-11-11. https://iinventedlight.com/library/notes/vite-hot-module-replacement/. License: CC-BY-4.0.

@misc{iil_note_qr958d39,
  author = {{iinventedlight}},
  title = {{Vite HMR updates modules over native ESM without a full reload}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-11},
  url = {https://iinventedlight.com/library/notes/vite-hot-module-replacement/},
  note = {Permanent ID iil:note:qr958d39. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/vite-hot-module-replacement.md.