-
-
Notifications
You must be signed in to change notification settings - Fork 112
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
Use renderToPipeableStream
instead of renderToString
in ssr-react
playground
#359
Comments
The playground is mostly for testing of vite plugin, so it's not necessary a goal to showcase React features. We would ideally only need to test where React requires bundler specific integration. Also, streaming SSR example currently exists on Another concern is that how to setup streaming ssr to create your own react framework on Vite can be quite opinionated (for example, there is an issue like #352 (comment)), so it's not too obvious what pattern we should test here. Having said that, I think it would be still nice if we can test it or at least discuss it here, so thanks for raising an issue. |
I understand. For context: my initial goal was not to use it for SSR, but to prerender all pages as static html files, and also have better code splitting via lazy/suspense components. I saw the example of |
Description
The playground ssr-react uses in the
entry-server.jsx
the methodReactDOMServer.renderToString
which does not support streaming or lazy / suspense components. I'd suggest to replace it withReactDOMServer.renderToPipeableStream
.Suggested solution
I have made a working example based on the playground (a tiny bit more complex, but in essence the same) here:
https://github.com/technologiestiftung/vite-react-ssg-example/blob/feat/add-streaming-for-suspense/src/entry-server.tsx
If desired, I can make a PR to add these changes. As far as I can tell, nothing else would need to be changed.
Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: