mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #665] fix: support CommonJS node_modules in Pages Router dev #754
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#754
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/665
Author: @southpolesteve
Created: 3/23/2026
Status: 🔄 Open
Base:
main← Head:codex/pages-router-cjs-node-modules📝 Commits (1)
ff56b46fix: support CommonJS node_modules in Pages Router dev📊 Changes
2 files changed (+215 additions, -3 deletions)
View changed files
📝
packages/vinext/src/server/dev-module-runner.ts(+131 -2)📝
tests/cjs.test.ts(+84 -1)📄 Description
Summary
node_modulesand.cjsmodules, while preserving Vite's normal ESM evaluator everywhere elsenode_modulesThis matches the Pages Router bug reported in #585. In Next.js, Pages Router dependencies are externalized by default unless
bundlePagesRouterDependenciesis enabled, so raw CommonJS packages should not crash dev SSR withmodule is not defined.Fixes #585.
Verification
vp test run tests/cjs.test.ts tests/node-modules-css.test.tsvp check packages/vinext/src/server/dev-module-runner.ts tests/cjs.test.tsNotes
@vitejs/plugin-rscpipeline and needs separate work tracked in #666.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.