Related plugins
Describe the bug
@vitejs/plugin-react v6 rejects React Fast Refresh for files that export both a React component and a static configuration object. Instead of hot-updating the component, the module is invalidated and a full page reload occurs.
This worked in v5 — the same file patterns were hot-refreshed without issues.
Reproduction
https://github.com/Artur-/vite-hmr-config-repro
Steps to reproduce
- Open http://localhost:5173
- Click "Increment" a few times to set count > 0
touch src/HelloView.tsx
- Observe that count resets to 0 (full reload instead of HMR)
- Vite outputs
4:08:22 PM [vite] (client) hmr invalidate /src/HelloView.tsx Could not Fast Refresh ("config" export is incompatible). Learn more at https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react#consistent-components-exports
Remove the export const config and edits hot-refresh correctly, preserving count state.
System Info
- `@vitejs/plugin-react`: 6.0.1
- `vite`: 8.0.8
- `react`: 19.2.5
Used Package Manager
npm
Logs
No response
Validations
Related plugins
plugin-react
plugin-react-swc
plugin-rsc
Describe the bug
@vitejs/plugin-reactv6 rejects React Fast Refresh for files that export both a React component and a static configuration object. Instead of hot-updating the component, the module is invalidated and a full page reload occurs.This worked in v5 — the same file patterns were hot-refreshed without issues.
Reproduction
https://github.com/Artur-/vite-hmr-config-repro
Steps to reproduce
touch src/HelloView.tsxRemove the
export const configand edits hot-refresh correctly, preserving count state.System Info
Used Package Manager
npm
Logs
No response
Validations