Skip to content

refactor(build): remove vite-plugin-commonjs - #2981

Draft
james-elicx wants to merge 17 commits into
codex/internal-commonjs-corefrom
codex/remove-vite-plugin-commonjs
Draft

refactor(build): remove vite-plugin-commonjs#2981
james-elicx wants to merge 17 commits into
codex/internal-commonjs-corefrom
codex/remove-vite-plugin-commonjs

Conversation

@james-elicx

@james-elicx james-elicx commented Aug 18, 2026

Copy link
Copy Markdown
Member

Summary

  • replace the application and next.config CommonJS wiring with the shared in-house transformer from the parent PR
  • preserve require export-condition resolution, static and patterned require behavior, aliases, bare packages, extensionless/index resolution, asset extensions, HMR watch inputs, and default-first interop
  • remove vite-plugin-commonjs and its vite-plugin-dynamic-import dependency closure
  • execute extensionless patterned requires across Node dev/prod, Cloudflare dev, bundled Workers, Pages-only Workers, and Nitro
  • port valuable upstream vite-plugin-commonjs and vite-plugin-dynamic-import cases as behavior-focused runtime/resolution tests

Stack

Validation

  • vp test run tests/commonjs-transform.test.ts tests/require-condition-resolution.test.ts tests/cjs.test.ts tests/cjs-globals-runtime.test.ts tests/import-meta-url.test.ts (133 passed)
  • vp test run tests/next-config-extensions.test.ts tests/next-config-runtime-shapes.test.ts tests/next-config.test.ts tests/init-cjs-config-resolve.test.ts (241 passed)
  • PLAYWRIGHT_PROJECT=pages-router-prod CI=1 pnpm run test:e2e -- tests/e2e/pages-router-prod/production.spec.ts -g patterned-dynamic-require (21 passed; full project selected by Playwright)
  • vp check
  • vp run vinext#build
  • pnpm install --offline --frozen-lockfile --ignore-scripts
  • dependency/source/dist searches and pnpm why show no remaining vite-plugin-commonjs or vite-plugin-dynamic-import closure

@pkg-pr-new

pkg-pr-new Bot commented Aug 18, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@vinext/cloudflare@2981
npm i https://pkg.pr.new/create-vinext-app@2981
npm i https://pkg.pr.new/@vinext/types@2981
npm i https://pkg.pr.new/vinext@2981

commit: c23b082

@github-actions

Copy link
Copy Markdown
Contributor
Example Preview Production Original
app-router-cloudflare preview production
pages-router-cloudflare preview production
app-router-playground preview production original
realworld-api-rest preview production
nextra-docs-template preview production
benchmarks preview production
hackernews preview production original
workers-cache preview production
web preview production

@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Performance benchmarks

Compared c23b082 against base 3267dfd using alternating same-runner rounds. Next.js was unchanged and skipped.

1 improved · 0 regressed · 5 within ±1.5%

Scenario Framework Baseline Current Change
Client bundle size (gzip) vinext 140.3 KB 140.3 KB ⚫ +0.0%
Client entry size (gzip) vinext 127.7 KB 127.7 KB ⚫ +0.0%
Dev server cold start vinext 3.08 s 2.99 s 🟢 -2.9%
Production build time vinext 3.38 s 3.40 s ⚫ +0.6%
RSC entry closure size (gzip) vinext 115.2 KB 115.2 KB ⚫ +0.0%
Server bundle size (gzip) vinext 196.3 KB 196.4 KB ⚫ +0.0%

View detailed results and traces

🟢 improvement · 🔴 regression · ⚫ change below 1.5% · paired base/head

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

@ask-bonk

ask-bonk Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

@james-elicx Bonk workflow was cancelled.

View workflow run · To retry, trigger Bonk again.

@james-elicx

Copy link
Copy Markdown
Member Author

/bigbonk review for issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant