You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the exports field of the react-dom's package.json, there is no "bun" field. Bun defaults to the "default" field for compatibility. However, the ./server.node.js file doesn't export renderToReadableStream(), while Bun supports Web Streams out of the box.
See: The Bun doc on Module resolution
This issue is similar to #26906, but Bun always supported Web Streams so there is no backwards compatibility issues.
React version: 18.3.1
Steps To Reproduce
Install react-dom.
Import renderToReadableStream()
Run the file using Bun
Notice that the error is something like this: SyntaxError: Export named 'renderToReadableStream' not found in module '~/??/node_modules/react-dom/server.node.js'., which clearly shows that Bun uses the default export.
Link to code example:
I am not sure how to use Bun on the browser.
The current behavior
Bun uses the default export. (aka server.node.js)
The expected behavior
Bun uses a custom "bun" export. (aka server.browser.js)
I have tested the following change locally and it completely fixes this issue:
The text was updated successfully, but these errors were encountered:
@Guibi1 for React 18 you can always just import the right version yourself if you know you are using bun. import ... from "react-dom/server.browser"
I don't think we'll do another 18 release with this but React 19 should support it. If bun also supported running with custom conditions you could potentially customize the resolution that way but I don't think it supports that right now
In the exports field of the
react-dom
's package.json, there is no "bun" field. Bun defaults to the "default" field for compatibility. However, the./server.node.js
file doesn't exportrenderToReadableStream()
, while Bun supports Web Streams out of the box.See: The Bun doc on Module resolution
This issue is similar to #26906, but Bun always supported Web Streams so there is no backwards compatibility issues.
React version: 18.3.1
Steps To Reproduce
react-dom
.renderToReadableStream()
SyntaxError: Export named 'renderToReadableStream' not found in module '~/??/node_modules/react-dom/server.node.js'.
, which clearly shows that Bun uses the default export.Link to code example:
I am not sure how to use Bun on the browser.
The current behavior
Bun uses the default export. (aka server.node.js)
The expected behavior
Bun uses a custom "bun" export. (aka server.browser.js)
I have tested the following change locally and it completely fixes this issue:
The text was updated successfully, but these errors were encountered: