-
-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could not Fast Refresh. Learn more at https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react#consistent-components-exports #411
Comments
This change was done in the version 3.1.0 of the plugin. You have two solutions that to keep an half broken HMR:
Otherwise you can opt-out of HMR and use https://github.com/owlsdepartment/vite-plugin-babel with the emotion plugin or https://github.com/unplugin/unplugin-swc with the equivalent rust plugin (should have faster builds), but you get full page reload on every change. But at least you don't end up with an state where you need to manually refresh when doing some changes to non component exports For info, at some point Vite will have a bundled dev mode where the react plugin can have HMR working despite having files that exports both utils and components, but it would take more than a year I think to get to it. |
@ArnaudBarre Thanks will try that
|
Yes the HMR logic/code is exactly the same! |
@ArnaudBarre This does reduce the number of instances |
Sorry my bad, the patch skip the export checks, but also the fast refresh update. Instead of the suggested patch, delete this line below |
Above change was not working expected as it was not triggering page refresh. I tried to find the root cause |
I'm not sure I'm following. You are saying that with Vite 5 + latest version of the react plugin + a patch that remove |
Project Structure examples Now when i update text for Continue button in @vitejs/plugin-react@4.3.4 + Vite@5.0.11 + (without removing @vitejs/plugin-react@4.3.4 + Vite@5.1.0-beta.0 + (without removing @vitejs/plugin-react@4.3.4 + Vite@5.1.0-beta.0 + (with removing |
Describe the bug
I am Working on a Mono Repo which has thousands line of code. Previously we were on Vite Version 4.4.9 and during that
the plugin was working as expected we were not any
hmr invalidate
but after upgrading to Vite 5. Now once i update file which exports all messages that is used by all other files now my terminal is bombarded with thousands ofhmr invalidate
messages.Sample is attached. Could you help why started hapening now and how can we move to older behaviour. As fixing all files to decouple util function exports and React Components exports is not possible as code base more than 20,000+ files
Could not Fast Refresh ("getCascadingArchivalSelectionError" export is incompatible). Learn more at https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react#consistent-components-exports 3:11:59 PM [vite] hmr update /File1.tsx, /File2.tsx 3:11:59 PM [vite] hmr invalidate /File2.utils.tsx Could not Fast Refresh ("getReplicationTargetSelectionError" export is incompatible). Learn more at https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react#consistent-components-exports
Reproduction
NA
Steps to reproduce
Starting Dev server using
vite --host
react({ jsxImportSource: '@emotion/react', babel: { plugins: ['@emotion/babel-plugin'], }, }),
System Info
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: