Web Development

What is Hot Module Replacement (HMR)?

A development feature that swaps updated modules into a running app without a full reload, preserving application state.

Definition

Hot module replacement injects edited code into the live page over a WebSocket connection instead of triggering a browser refresh, so form inputs, component state, and scroll position survive an edit. Vite's HMR is near-instant because it serves native ES modules and invalidates only the changed file's import chain; Webpack's dev server pioneered the approach. Framework integrations add state-preserving semantics: React Fast Refresh re-renders edited components while keeping hooks state, and Vue's HMR hot-swaps single-file components. When a module can't self-accept an update, HMR falls back to a full reload rather than running stale code.

Related Terms

More in Web Development

Keep the references coming

One email a week: new and trending developer tools, fresh comparisons, and what shipped. Unsubscribe in one click.