Open
Description
I'm using React Router as a...
framework
Reproduction
- either create a new React Router project from a template or go to this newly created stackblitz
- open
app/routes/home.tsx
- modify the code (no new exports or imports)
- check the HMR logs. You should see the message
[vite] hot updated: /app/routes/home.tsx
being triggered multiple times
Observations:
- disabling SSR appears to reduce the number of updates to just 2.
- this issue occurs also when modifying a component, not a route specifically.
- when adding a console log to the modified file, it’s clear that the module is being re-evaluated multiple times.
- for some reason,
/app/app.css
is being updated as well, even though it is unrelated to the changed module. - this issue doesn’t occur when using standalone Vite.
System Info
Binaries:
Node: 23.11.0 - ~/.nvm/versions/node/v23.11.0/bin/node
npm: 10.9.2 - ~/.nvm/versions/node/v23.11.0/bin/npm
npmPackages:
@react-router/dev: ^7.5.3 => 7.6.2
@react-router/node: ^7.5.3 => 7.6.2
@react-router/serve: ^7.5.3 => 7.6.2
react-router: ^7.5.3 => 7.6.2
vite: ^6.3.3 => 6.3.5
Used Package Manager
npm
Expected Behavior
HMR updates with minimal evaluations
Actual Behavior
- re-evaluated multiple times (2–3)
- HMR is also triggered for an unrelated CSS module