Hot reloading doesn't work, the application is always fully reloading.
antran22 opened this issue · comments
Description
Hot reloading doesn't work, the application is always fully reloading even on minor changes.
Reproduction setup
Bundler: Webpack
The setup is a bit complex, we want to develop Preact components over a pre-existing backend. The Preact component is wrapped into a custom component using preact-custom-element
, then injected into the backend as plain HTML.
After investigating, we found the error by patching
prefresh/packages/vite/src/index.js
Line 94 in a6c9be9
TypeError: can't access property "__P", vnode.__c is null
replaceComponent index.js:57
...
The faulty line:
prefresh/packages/core/src/index.js
Line 57 in a6c9be9
Analysis: this is an unsafe deep access. Patching to if (!vnode.__c || !vnode.__c.__P) return;
keeps the error from throwing, and allow the hot reload process to continue.
I have not fully understood the full cause of why vnode.__c
is null, however by patching this I managed to get hot reloading working.
A PR with this patch is created #514