-
Notifications
You must be signed in to change notification settings - Fork 1k
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
RSC: vite/clientSsr #10238
RSC: vite/clientSsr #10238
Conversation
b1e88c1
to
163d02b
Compare
d3a8f4d
to
1e8f9cf
Compare
6e1ff6b
to
d47d3b4
Compare
d47d3b4
to
93fc69d
Compare
b0ea8da
to
cd3a18f
Compare
It's not really about external/noExternal here. It's about only using one version of the library, and one that's built with the right conditions. rsdw will import React, so it's important that it imports the same version of React as we are. If we're pulling rsdw from node_modules (which we would if we didn't get it from the dist folder) we'd also get the node_modules version of React. But the app itself already uses the bundled version of React, so we can't do that, because then we'd have to different Reacts where one isn't initialized properly |
e5f4bb2
to
53c1234
Compare
This PR introduces a new function called
renderFromDist
that is ment to be used during SSR. It's supposed to do whatrenderFromRscServer
does during normal browsing.renderFromDist
internally will directly read files out of thedist/rsc/
directory (hence the name). During normal browsing the RSC server would read those files and construct a flight stream using them. During SSR we can directly read them and userenderToReadableStream
to build that flight stream. And then usecreateFromReadableStream
instead ofcreateFromFetch
to create a React Component from that flight data.