web dev//HMR
HMR (Hot Module Replacement) is a development-server feature that swaps only the affected module in the browser when a source file changes, without a full page reload, so the app state (forms, scroll position, data) is preserved while the developer works. Without HMR, every change requires saving, rebuilding and manually reloading the page; with HMR, the change appears in the browser on save.
HMR (Hot Module Replacement) is a development-server feature that swaps only the affected module in the browser when a source file changes, without a full page reload, so the app state (forms, scroll position, data) is preserved while the developer works. Without HMR, every change requires saving, rebuilding and manually reloading the page; with HMR, the change appears in the browser on save.
Vite provides HMR for the frontend: when a .tsx file changes, the component updates in the browser instantly.
Wrangler has HMR for functions (API and backend): when a handler changes, Wrangler reloads it. It has no HMR for the frontend, because it serves pre-compiled files from dist/.
That is why development uses two terminals: Vite for frontend HMR, Wrangler for the API.