-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[React 18] react-dom/server resolution on worker runtimes #2299
Comments
Or maybe we could alias |
It seems like esbuild allows to override I'm willing to file a PR for this, so please let me know what do you think about this approach. |
Should be fixed by #1977. Nice! |
Now that #1977 is fixed and published on
remix doesn't recognize the Interestingly, the above code works in dev mode, but not when deployed to cf-workers. |
This should be fixed in the latest version of Remix which has options for configuring module resolution during the server build. Please update your {
"serverConditions": ["workerd", "worker", "browser"]
} |
What version of Remix are you using?
1.2.3
Steps to Reproduce
react-dom@rc react@rc
on project using a worker runtime (such as Cloudflare Workers). I tested this on Cloudflare Pages.renderToReadableStream
onentry.server.js
. Mine looks like this:Expected Behavior
It should load
server.browser.js
as it's specified on theworker
exports field ofreact-dom
.Ok, I know this API isn't even released yet and is not meant to be used right now but I'm guessing Remix would likely adopt React 18 so I thought this is worth investigating.
This happens because esbuild has no target setting for Workers yet so Remix currently uses
neutral
which loads default export.However,
react-dom
exportsserver.node.js
by default which uses some Node.js-specific APIs such as Buffer, which isn't available on Cloudflare nor Miniflare. I'm not quite sure why this has worked before (maybe Node.js API calls were DCE'd because it isn't used forrenderToString
?), but when it is used withrenderToReadableStream
it doesn't work as intended.This may need to be addressed on esbuild and thus may be considered as an upstream issue.
References
Actual Behavior
Your message may vary but it would likely fail on
react-dom-server.node.something.js
.The text was updated successfully, but these errors were encountered: