-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
HMR not working with backend integration #101
Comments
This https://vitejs.dev/guide/troubleshooting.html#vite-detects-a-file-change-but-the-hmr-is-not-working |
@sapphi-red thanks for your response. Somehow the filename was showing as capitalized on my file system. To remove confusion, I've renamed the file to However the problem persists, can you re-open this issue? |
I think to Follow react convention, this file should be rename to App.tsx actually. @jvanmaaren Can you tell me if you stil experiencing the issue when the file is |
Thanks for thinking along @ArnaudBarre, yes on my localmachine Example is updated to use
|
I will take a look in the coming days (can't today) |
Ah, I was able to reproduce. It seems this is caused by duplicated vitejs/vite#5656 needs to be fixed to avoid these problems. (related: vitejs/vite#9700 (comment)) |
Thanks for investigating! So I think this cannot be fixed on the plugin side. I think we should change the main doc (https://vitejs.dev/guide/backend-integration.html#backend-integration) to say to use |
@ArnaudBarre Would it be possible to detect this on the plugin side? |
I though so when we discussed it, but when we resolve/load the id, Vite as already removed the base prefix, so I don't see how to detect a missing base. And I don't see how to detect if the runtime code was loaded twice because of two connected browser or because of this issue. |
When we were discussing I didn't have a concrete idea, but now I have one. <script type="module">
import RefreshRuntime from 'http://localhost:5173/@react-refresh'
RefreshRuntime.injectIntoGlobalHook(window)
window.$RefreshReg$ = () => {}
window.$RefreshSig$ = () => (type) => type
- window.__vite_plugin_react_preamble_installed__ = true
+ RefreshRuntime.__vite_plugin_react_preamble_installed__ = true
</script> |
Oh no let's keep it on the window and use it to detect that two runtimes are instantiate (and throw in that case) |
Thanks for looking into this all ❤️ I'll try again once this is released |
This is only a warning for helping other people having the same issue as you. The real fix is adding the path prefix before @react-refresh in |
Oh now I understand, many thanks, it's working now I've updated the example repo |
Describe the bug
Hi all, I have a problem I hope you can help me with
During development any changes to Javascript doesn't update the DOM, although the server and console both report "[vite] hot updated: /App.tsx"
Reproduction
https://github.com/jvanmaaren/vite-update-problem
Steps to reproduce
Setup
I'm using a backend integration:
https://vitejs.dev/guide/backend-integration.html#backend-integration
Python is running on port 8000 and is including the dev environment
Vite is running on port 8080
To reproduce:
yarn
some-other-server/index.html
on port 8000, for instance using:cd some-other-server && python3 -m http.server 8000
yarn dev
localhost:8000
System Info
Used Package Manager
yarn
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: