Problem
vinext dev is unusable for react.dev: the SSR module-runner inlines externalized deps without CJS interop, so common UMD/CJS deps throw at module eval.
Repro (npm run dev:vinext, then GET any page)
classnames (UMD, module.exports inside an IIFE) → ReferenceError: window is not defined at classnames/index.js.
parse-numeric-range (CJS) → ReferenceError: exports is not defined.
- Result: every page 500s in dev.
vinext build + vinext start are fine — rolldown's full bundle interops these correctly. The problem is specific to the dev module-runner's on-demand inlining.
Workaround used (partial)
optimizeDeps.include / ssr.optimizeDeps.include for the offending deps — but this is whack-a-mole; any UMD/CJS dep with IIFE-wrapped module.exports hits it.
Suggested fix
The dev SSR module-runner should apply CJS→ESM interop to inlined node_modules deps (detecting module.exports/exports even inside an IIFE), matching the build path.
Problem
vinext devis unusable for react.dev: the SSR module-runner inlines externalized deps without CJS interop, so common UMD/CJS deps throw at module eval.Repro (
npm run dev:vinext, then GET any page)classnames(UMD,module.exportsinside an IIFE) →ReferenceError: window is not definedatclassnames/index.js.parse-numeric-range(CJS) →ReferenceError: exports is not defined.vinext build+vinext startare fine — rolldown's full bundle interops these correctly. The problem is specific to the dev module-runner's on-demand inlining.Workaround used (partial)
optimizeDeps.include/ssr.optimizeDeps.includefor the offending deps — but this is whack-a-mole; any UMD/CJS dep with IIFE-wrappedmodule.exportshits it.Suggested fix
The dev SSR module-runner should apply CJS→ESM interop to inlined node_modules deps (detecting
module.exports/exportseven inside an IIFE), matching the build path.