Skip to content

refactor(build): add in-house CommonJS transform - #2980

Draft
james-elicx wants to merge 5 commits into
mainfrom
codex/internal-commonjs-core
Draft

refactor(build): add in-house CommonJS transform#2980
james-elicx wants to merge 5 commits into
mainfrom
codex/internal-commonjs-core

Conversation

@james-elicx

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

Copy link
Copy Markdown
Member

Summary

  • add a scope-aware internal transform for static require(), module.exports, and named CommonJS exports
  • use existing vinext AST/scope/source-map utilities with collision-safe helpers
  • port the upstream Next.js extensionless patterned dynamic-require fixture as characterization coverage for the follow-up

Stack

  1. This PR: internal transformation foundation and characterization tests
  2. refactor(build): remove vite-plugin-commonjs #2981: wire application/config pipelines, internalize patterned resolution, validate all runtimes, and remove vite-plugin-commonjs

Both PRs are drafts. #2981 intentionally targets this branch.

Validation

  • vp test run tests/commonjs-transform.test.ts
  • vp test run tests/cjs.test.ts
  • focused vp check
  • Pages Router production Playwright patterned-require test
  • full CI, deploy examples, and smoke tests green on e268057

@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@2980
npm i https://pkg.pr.new/create-vinext-app@2980
npm i https://pkg.pr.new/@vinext/types@2980
npm i https://pkg.pr.new/vinext@2980

commit: 3267dfd

@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 3267dfd against base 2dcd9f2 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.18 s 3.13 s 🟢 -1.8%
Production build time vinext 3.54 s 3.51 s ⚫ -1.0%
RSC entry closure size (gzip) vinext 115.2 KB 115.3 KB ⚫ +0.1%
Server bundle size (gzip) vinext 196.4 KB 196.5 KB ⚫ +0.1%

View detailed results and traces

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

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