-
-
Notifications
You must be signed in to change notification settings - Fork 121
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
fix: fix fast-refresh for files that are transformed into jsx #188
Conversation
Oh yeah this check is clearly a refactor issue. What's the use case for having JSX inside |
Currently
|
Possibly related - I have a project ported over from create-react-app (and which used JS files). HMR will not work on .js files until I do one of the following:
|
Vite emits error if you use jsx syntax in Example: https://stackblitz.com/edit/vitejs-vite-cyjzmi?file=src%2FApp.js Can you reproduce your issue in this demo? |
|
https://stackblitz.com/edit/vitejs-vite-p5o1nn?file=src%2FApp.js (Changing something in App.js) |
After some digging, I think the issue is similar (incorrect useFastRefresh) but it is not fixed by this PR. I have added a reproduction to the plugin repo: https://github.com/csr632/vite-plugin-react-1/tree/react-js-ext-demo. |
Its not unreasonable to js -> jsx, I was just trying to minimize the number of changes in order to do the initial port. It may also be a common case converting from create-react-app which may help uptake. |
I tried locally installing the package from a local repo checkout with this change. As you note, didn't work. |
TODO: wait for vitejs/vite-plugin-react#188 to be published and bump the dep version
TODO: wait for vitejs/vite-plugin-react#188 to be published and bump the dep version
TODO: wait for vitejs/vite-plugin-react#188 to be published and bump the dep version
TODO: wait for vitejs/vite-plugin-react#188 to be published and bump the dep version
TODO: wait for vitejs/vite-plugin-react#188 to be published and bump the dep version
TODO: wait for vitejs/vite-plugin-react#188 to be published and bump the dep version
Description
Previous useFastRefresh check is wrong. It causes fast-refresh not working for files with extension such as
.md
. Checkout the updated playground and the test as a demo.Additional context
The first commit update the test that fails and demonstrates the issue. The second commit fix the issue and make the test pass.
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).