react-server675fbba4
react-servercommit50ee22a3308e

fix: vite cjs external facade (#391)

The dev server was silently losing the CJS external-facade patch after the Rolldown upgrade. The fixCjsExternalFacade plugin rewrites module.exports = { ...m } to module.exports = m.default ?? m in Vite's generated CJS shim so default-export interop survives optimizeDeps pre-bundling — without that rewrite, consumers of CJS-exposed packages get an empty namespace spread where they expect the default export.

Two things had drifted and needed to be re-aligned. First, Rolldown started emitting the facade under the id vite:cjs-external-facade (colon form) in addition to the legacy vite_cjs-external-facade underscore form. The plugin's id match was too narrow and quietly stopped firing; this change makes the transform accept both ids. Second, the plugin wasn't actually registered in the dev server's optimizeDeps.rolldownOptions.plugins array, so even when the id matched we weren't applying it at the right stage. The dev createServer config now prepends fixCjsExternalFacade() there (while preserving any user-supplied rolldown plugins).

The branch also lands a round of RSC coverage work that was in flight on the same working copy: new test suites for the client-side Flight wire format (flight-client-coverage.test.mjs), server-side coverage gaps (flight-coverage-gaps.test.mjs), and the React hooks dispatcher shim (flight-hooks-dispatcher.test.mjs), plus a couple of cross-compat test fixes (webpack globals mock in setup.mjs, expectClientRef accepting the eager-resolve code path). If you'd prefer these be split out into a separate PR, happy to do that — they're additive and don't touch the runtime.

Author
Viktor Lázár <lazarv1982@gmail.com>
Date
Commit
50ee22a3308ef0fe5be4131312e6f99f2ee12d1f
8 files changed+2525 -9