Preact SSR: Cannot read properties of undefined (reading '__H') #1235
-
This is similar to #1071 - it's more of a question of what comes afterward. I have a Redux-powered Preact SSR app that I'm trying to move over to Vike. I went ahead and installed After adding this entry to
It seems the necessary libraries can find Preact, but I'm encountering what seems to be an ESM/CJS issue:
I have encountered this in other environments, and the problem comes down to the ESM and CJS versions of Preact being loaded. In this particular case, the ESM version of Preact created the component, but the CJS version of Preact is trying to execute a hook on the component, and cannot find it, because it's in the wrong scope. I thought I'd put this on your radar in case you've experienced this and have any quick solutions. In other environments I forced the use of CJS Preact by |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Such ESM/CJS issues are outside of Vike's realm. That said, if you can create a reproduction that is minimal, then I'll have a look at it. |
Beta Was this translation helpful? Give feedback.
-
Here you go: https://github.com/JeffreyATW/vike-preact-server-routing/tree/jeffreyatw/react-redux |
Beta Was this translation helpful? Give feedback.
-
That solved it - thanks! |
Beta Was this translation helpful? Give feedback.
@JeffreyATW sorry for the delay, here is my fix: JeffreyATW/vike-preact-server-routing#1
The main part of it being