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 when using react -> @preact/compat override in package.json #76
Comments
Thanks for filing an issue. Can you share code or the steps with which we can reproduce the issue? Happy to look into it. |
Thanks so much for your reply. I tried to reproduce, found I couldn't, then spent a few hours looking into this. Rather, it turned out that:
"overrides": {
"react": "npm:@preact/compat@17.1.2",
"react-dom": "npm:@preact/compat@17.1.2"
}
I'm not sure how to explain all the above. I suspect that when importing render from That's a bit vague for my liking but I'm not sure I can pin it down any further with only limited knowledge about preact, @preact/compat, preset-vite, and vite itself. This also leaves me unsure if using (I've updated the title and description in this issue to make clear it turned out not to have anything to do with the presence of a dynamic backend.) Edit: Just removing |
Edit: I initially thought it was a dynamic backend that was causing this issue, this turned out to be wrong. Skip to my next comment as what I wrote here turned out to be a red herring.
Our project uses a dynamic backend. I'm trying to switch it to use preact and
@preact/preset-vite
is looking like almost a drop-in replacement, which is fairly amazing.However, HMR isn't working. On https://vitejs.dev/guide/backend-integration.html for HMR with react we have this:
(When the above is included in our served HTML with this preset in use and react removed, it errors in the browser console, so I assume it is not to be included when using this preset, though I'm not entirely confident in that.)
This leads me to wonder if there is an equivalent piece of code that is missing from our dynamically served backend when using this preset?
The text was updated successfully, but these errors were encountered: