Closed happyeric77 closed 2 months ago
Looks like server side rendering of class components isn't working as expected.
in svelte.config.js:
preprocessReact({ ssr: false })`
or
Disable SSR for a specific +page.js
(also affects Svelte components)
export const ssr = false;
Thanks for reporting the issue, i'll investigate the issue further at a later moment, this should work or at least not result in a 500.
Hmm, either Vite
or the react-youtube
package is doing something wrong.
<script>
import DefaultExport from "react-youtube";
let YouTube = DefaultExport.default || DefaultExport // <- fixes the issue
</script>
<react:YouTube videoId="AdNJ3fydeao" />
Client imports dist/YouTube.esm.js
but the Server imports dist/YouTube.js
from react-youtube.
On the server YouTube was not the component but an object with a property default containing the component.
Thank you so much! @bfanger. It at least unblocks me at this point🙏 . Feel free to close this issue if it is not supposed to have further change.
BTW totally not related to this topic but I just want to ask do we have any reference of using react contexts so that I will be able to consume the context at children components by wrapping the parent component with react context component.
ex. how to retrieve the exported context value in svelte component
Examples are here: https://github.com/bfanger/svelte-preprocess-react/tree/main/src/routes
context and hooks are relevant,
To read React context in Svelte you’d run the useContext using the hooks helper
Hello team, I created a brand new svelte project using
npx create-svelte notifi-svelte-example
. Then I follow exactly the doc mentioned.Please see my package.json below:
And my svelte.config.js is like below:
Then the
+page.svelte
:After all setting up, I run
npm run dev
. Then the error shows on backend like belowAt frontend, it just simply renders nothing with 500 internal error.
Cannot really tell what is happening and not sure if I do miss anything. I also share the project on my github repo herewith: https://github.com/happyeric77/svelte-react-example. Is it possible to give me a hint?