Open krutoo opened 1 year ago
Hello I think this is not the bug in React-dom I have checked both the official documentation repository there are mentions about the reanderToReadableStream there you wrote an incorrect code here is the updated code.
import ReactDOMServer from 'react-dom/server;
const { renderToString, renderToReadableStream } = ReactDOMServer;
console.log({ renderToString, renderToReadableStream });
because the error says that it is the syntax error Named export 'renderToReadableStream' not found. The requested module 'react-dom/server' is a CommonJS module, which may not support all module.exports as named exports.
@MeenuyD I tried your snippet and it doesn't work either
Node.js exposes WebStream to global since 18.+, but react-dom/server
does not export renderToReadableStream without checking if it present.
Is it possible to add renderToReadableStream
to Node.js package?
Ditto - often when building and testing things locally the runtime is node, while the final deploy target is edge (cloudflare, etc). Because renderToReadableStream
is not exposed on the node build, we have to do a dance to make everything work.
Any particular reason to not include renderToReadableStream
on the node build? Made sense when node did not have support for web streams, but it has for a while now, and now that everybody seems to be converging on the web streams standard perhaps it makes more sense to include?
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
bump
Bump, there is no export from the ./server.node.js file. Is there a reason for it?
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
bump
bump
I try to use
renderToReadableStream
function fromreact-dom/server
in Node.js but there is no such function in package.React version: 18.2.0 Node.js version 16.15.0 or 18.16.0
Steps To Reproduce
index.mjs
fileinsert code:
node index.mjs
in terminalLink to code example:
StackBlitz
The current behavior
Error in terminal:
The expected behavior
Node.js suupports web streams in experimental mode.
The package
react-dom/server
must have a functionrenderToReadableStream
according to the documentation: https://react.dev/reference/react-dom/server/renderToReadableStream