-
Notifications
You must be signed in to change notification settings - Fork 50k
Description
React version: 19.2.0
Steps To Reproduce
- clone https://github.com/Yovach/deno-tanstack-start-bug-reproduction
- deno install
- deno task build
The current behavior
It's hanging forever.
The expected behavior
Not hanging on deno task build
Context
I've been investigating the vite build hanging issue in Deno and found the root cause. denoland/deno#31248
Seems that react-dom package.json maps Deno to use the browser bundle (server.browser.js) instead of the node bundle. The browser bundle creates a MessageChannel for task scheduling, and this MessageChannel keeps Deno's process alive forever, causing the hang.
Runtime mappings:
• Node.js → uses setImmediate from server.node.js (doesn't block exit) ✅
• Bun → uses queueMicrotask from server.bun.js (doesn't block exit) ✅
• Deno → uses MessageChannel from server.browser.js (blocks exit forever) ❌
Solutions
Changing the "deno" mapping from "./server.browser.js" to "./server.node.js" at node_modules/.deno/react-dom@19.2.0/node_modules/react-dom/package.json fixed the hang.
I also tested changing the bun bundler to use server.browser.js, to have sure that this is the problem, and it hangs for bun too.
I talked with the Deno CLI team, and we decided to create this issue to check if make sense have a new bundle for Deno. For some reason, seems that solution was rejected in the past (#30655 (comment))
If it does not make sense again, we will need to add a special condition for react-dom on Deno side.