next.js
608b569c - Bundle the `'use cache'` deadlock probe worker (#93538)

Commit
17 hours ago
Bundle the `'use cache'` deadlock probe worker (#93538) Follow-up to #93500. The probe worker (`use-cache-probe-worker.ts`) ships as plain `tsc` output and `require()`s `react-server-dom-webpack/server` directly. The merged PR added a require-hook entry covering only that one specifier, which is not enough. The vendored RSC binding itself does plain `require('react')` and `require('react-dom')`, and with `--conditions=react-server` set on the worker those fall through to the user's installed React. For any Next.js app on React 18 that means React 18's `react.shared-subset`, a stub that throws `"not yet supported outside of experimental channels"`. The probe crashes the moment it spawns. Default canary tests didn't catch this — their installed React 19 supports the `react-server` condition — but running the suite with `NEXT_TEST_REACT_VERSION="18.3.1"` surfaced it. Adding more hook entries to cover `react`, `react-dom`, etc. would mean manually mirroring the `${bundler} × ${reactChannel}` matrix that `makeAppAliases` and the `react-server` layer rule in `next-runtime.webpack-config.js` already encode for `react`, `react-dom`, `react/jsx-*`, and `react-server-dom-{webpack,turbopack}/*`. The worker is now bundled through that pipeline as a new `'app-worker'` bundleType, which inherits the alias matrix and is included in the `react-server.node` layer rule. Four dev-only tasks (`{turbo,webpack} × {experimental,stable}`) produce the four artifacts. In `use-cache-probe-pool.ts` when the pool is created we resolve the matching bundle via `process.env.TURBOPACK` and `needsExperimentalReact(nextConfig)`. The worker source uses a plain static import of `react-server-dom-webpack/server`, as we do everywhere else. The require-hook entry is deleted, and `--conditions=react-server` is no longer added to `NODE_OPTIONS` since all React specifiers resolve to absolute paths at build time.
Author
Parents
Loading