-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
Fast Refresh not working with automatic runtime and file extension without "x" #83
Closed
7 tasks done
Labels
enhancement
New feature or request
Comments
Thanks for the repro. I will take this into account for the API of the v4 |
@ArnaudBarre Thanks! 🙂 I think that at
import * as React from 'react'; , we should check for the package name (one of "react", "react/jsx-runtime", or "react/jsx-dev-runtime"). Right?
|
This would work for jsx because this is the only use for this subpath, but not for "react", because this can be a file with just React hooks. This condition needs to be adapted based on the runtime type, I will do that |
I think with can use /^[A-Z]([^\.])+\.[t|j]sx?/.test(filepath.split("/").pop()) because all components files start with UpperCase |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the bug
Currently, fast refresh is working for a file only if either
React
in some wayNow when using a compile-to-JS language like ReScript with the new JSX runtime enabled, one can get
.js
or.mjs
files with imports from "react/jsx-runtime" or "react/jsx-dev-runtime", but noReact
import, and fast refresh will not work for these files.Reproduction
https://github.com/cknitt/vite-plugin-react-fast-refresh-issue
Steps to reproduce
TestComponent.bs.js
(alternatively change it in TestComponent.res and runnpm run res:build
to recompile). Observe that the counter value is reset to 0.Workaround
npx patch-package
to apply the patch frompatches/@vitejs+plugin-react+3.0.1.patch
.System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: