A Vite plugin that forces a full page reload when your SSR entry file changes and injects the Vite client script for HMR in SSR contexts. Current stable version is 0.5.0, released October 2024, with a release cadence of minor versions every few months. Key differentiators: lightweight, no external dependencies, supports React refresh injection, and customizable entry/ignore patterns. Requires Node >= 18.0.0 and Vite.
npm install vite-plugin-ssr-hot-reloadVerified import paths — ran on the pinned version, not inferred.
Shows usage with entry, ignore, and injectReactRefresh options in Vite config.
Install @vitejs/plugin-react and add react() plugin before ssrHotReload.
Ensure your HTML head can accept scripts at the end; no code change needed.
Upgrade Node to version 18 or higher.
Update to version >=0.3.0 which handles this internally. No user action needed.
Update to version >=0.3.2 or avoid leading slashes in paths.
Update to v0.3.3+ which fixes this; ensure you are not calling response methods after plugin injection.
Use import instead of require, and ensure your project uses ESM (package.json type: module) or use dynamic import.
Use default import: import ssrHotReload from 'vite-plugin-ssr-hot-reload'
Install @vitejs/plugin-react (npm install -D @vitejs/plugin-react) and add react() to Vite plugins.