-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
🐛 BUG: Using preact/compat
with solid-js
leads to "Cannot read properties of null (reading 'useRef')"
#4093
Comments
I think this isn't directly related to Solid and is an issue with preact/compat and the |
Made a little bit of progress here: https://github.com/withastro/astro/tree/preact-compat-issue
Going to chat with @bluwy about this. The issues I'm running into are:
Here is my forked stackblitz: https://stackblitz.com/edit/github-bltmyz-5rgtvb?file=astro.config.mjs Steps to get to where I left off:
|
Oh that's super interesting. I think I got confused by the original error message because it says Does Also, if |
I'm sure that preact/compat is not compatible with all React packages, that's an impossible ask. But I don't yet know if its compatible with this one or not, there's an underlying bug we have to fix first. #4107 could be the same issue, assigning it to myself until we figure this one out. |
I managed to trim down the issue to Vite's SSR transform, which incorrectly transforms: export * from 'vue'
import {createApp} from 'vue'
export {createApp as bar} to const __vite_ssr_import_1__ = await __vite_ssr_import__("vue");
__vite_ssr_exportAll__(__vite_ssr_import_1__);
Object.defineProperty(__vite_ssr_exports__, "bar", { enumerable: true, configurable: true, get(){ return __vite_ssr_import_0__.createApp }}); Note the |
Note: This should be good when vitejs/vite#9554 is released and the Vite version used by Astro is bumped (currently pinned). And also a combination of the fix in this branch. |
What version of
astro
are you using?1.0.0-rc.1
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
npm
What operating system are you using?
Windows
Describe the Bug
See linked stackblitz. Using
client:load
causes the solid-js adapter to mess with preact components. Usingclient:only
makes the error go away.I've also seen other variations of this issue, e.g. the react adapter sometimes messes with solid-js components. Will update this issue with more links (or create a new one) if I bump into that again.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-bltmyz?file=src%2Fpages%2Findex.astro
Participation
The text was updated successfully, but these errors were encountered: