Skip to content

Conversation

@Garvitpant777
Copy link

When using react-dom/server in Deno (e.g. during SSR/pre-rendering with Vite, esbuild, Rollup, TanStack Start, etc.), the current conditional export maps the deno condition to server.browser.js.

That file creates a MessageChannel for task scheduling. In Deno, an open MessageChannel port prevents the process from exiting, causing bundlers to hang forever.

Fix

Change the Deno condition to use the Node.js server bundle instead:

-  "deno": "./server.browser.js",
+  "deno": "./server.node.js",

server.node.js uses setImmediate (fully supported and non-blocking in Deno) instead of MessageChannel, so the process exits cleanly.

Impact

Instantly fixes indefinite hangs for all Deno users performing SSR/pre-rendering builds
No behavioral change for Node, Bun, Edge, Workerd, or browser environments
No new bundle required – Deno already has excellent Node.js compatibility

Reproduction & Verification
Repository: https://github.com/Yovach/deno-tanstack-start-bug-reproduction
Before (official react-dom 19.2.0)
→ deno task build or npm run build hangs forever
After applying this one-line change
→ build completes successfully in ~2–3 seconds:

✔ 62 modules transformed.
...
✔ built in 2.90s

Closes #35231



<img width="546" height="273" alt="React_PR" src="https://github.com/user-attachments/assets/bb029b34-c2b6-4c31-9608-1d1127777caa" />

@acdlite @sebmarkbage @lunaruan @bvaughn @trueadm @eps1lon @fraidev @Yovach   Please check this out...


<img width="546" height="273" alt="React_PR" src="https://github.com/user-attachments/assets/2095bfba-5e71-4745-8a2d-45673d07ab45" />

@meta-cla
Copy link

meta-cla bot commented Nov 28, 2025

Hi @Garvitpant777!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla
Copy link

meta-cla bot commented Nov 28, 2025

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla bot added the CLA Signed label Nov 28, 2025
@Garvitpant777
Copy link
Author

When using react-dom/server in Deno (e.g. during SSR/pre-rendering with Vite, esbuild, Rollup, TanStack Start, etc.), the current conditional export maps the deno condition to server.browser.js.

That file creates a MessageChannel for task scheduling. In Deno, an open MessageChannel port prevents the process from exiting, causing bundlers to hang forever.

Fix

Change the Deno condition to use the Node.js server bundle instead:

  • "deno": "./server.browser.js",
  • "deno": "./server.node.js",

server.node.js uses setImmediate (fully supported and non-blocking in Deno) instead of MessageChannel, so the process exits cleanly.

Impact

Instantly fixes indefinite hangs for all Deno users performing SSR/pre-rendering builds
No behavioral change for Node, Bun, Edge, Workerd, or browser environments
No new bundle required – Deno already has excellent Node.js compatibility

Reproduction & Verification
Repository: https://github.com/Yovach/deno-tanstack-start-bug-reproduction
Before (official react-dom 19.2.0)
→ deno task build or npm run build hangs forever
After applying this one-line change
→ build completes successfully in ~2–3 seconds:

✔ 62 modules transformed.
...
✔ built in 2.90s

Closes #35231

React_PR

@acdlite @sebmarkbage @lunaruan @bvaughn @trueadm @eps1lon @fraidev @Yovach Please check this out...

React_PR

@Yovach
Copy link

Yovach commented Dec 1, 2025

When using react-dom/server in Deno (e.g. during SSR/pre-rendering with Vite, esbuild, Rollup, TanStack Start, etc.), the current conditional export maps the deno condition to server.browser.js.

That file creates a MessageChannel for task scheduling. In Deno, an open MessageChannel port prevents the process from exiting, causing bundlers to hang forever.

Fix

Change the Deno condition to use the Node.js server bundle instead:

* "deno": "./server.browser.js",


* "deno": "./server.node.js",

server.node.js uses setImmediate (fully supported and non-blocking in Deno) instead of MessageChannel, so the process exits cleanly.

Impact

Instantly fixes indefinite hangs for all Deno users performing SSR/pre-rendering builds No behavioral change for Node, Bun, Edge, Workerd, or browser environments No new bundle required – Deno already has excellent Node.js compatibility

Reproduction & Verification Repository: https://github.com/Yovach/deno-tanstack-start-bug-reproduction Before (official react-dom 19.2.0) → deno task build or npm run build hangs forever After applying this one-line change → build completes successfully in ~2–3 seconds:

✔ 62 modules transformed. ... ✔ built in 2.90s

Closes #35231
React_PR

@acdlite @sebmarkbage @lunaruan @bvaughn @trueadm @eps1lon @fraidev @Yovach Please check this out...
React_PR

Hi, a user already provided a PR here : #35235

@Garvitpant777
Copy link
Author

When using react-dom/server in Deno (e.g. during SSR/pre-rendering with Vite, esbuild, Rollup, TanStack Start, etc.), the current conditional export maps the deno condition to server.browser.js.
That file creates a MessageChannel for task scheduling. In Deno, an open MessageChannel port prevents the process from exiting, causing bundlers to hang forever.

Fix

Change the Deno condition to use the Node.js server bundle instead:

* "deno": "./server.browser.js",


* "deno": "./server.node.js",

server.node.js uses setImmediate (fully supported and non-blocking in Deno) instead of MessageChannel, so the process exits cleanly.
Impact
Instantly fixes indefinite hangs for all Deno users performing SSR/pre-rendering builds No behavioral change for Node, Bun, Edge, Workerd, or browser environments No new bundle required – Deno already has excellent Node.js compatibility
Reproduction & Verification Repository: https://github.com/Yovach/deno-tanstack-start-bug-reproduction Before (official react-dom 19.2.0) → deno task build or npm run build hangs forever After applying this one-line change → build completes successfully in ~2–3 seconds:
✔ 62 modules transformed. ... ✔ built in 2.90s
Closes #35231
React_PR
@acdlite @sebmarkbage @lunaruan @bvaughn @trueadm @eps1lon @fraidev @Yovach Please check this out...
React_PR

Hi, a user already provided a PR here : #35235

With due respect would you please merge my solution if it seems a good fit to you ... Thank You

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants