Skip to content

test(optimizer): add CJS __esModule interop tests#21519

Merged
sapphi-red merged 6 commits intomainfrom
copilot/port-tests-from-vite-pr-16437
Jan 29, 2026
Merged

test(optimizer): add CJS __esModule interop tests#21519
sapphi-red merged 6 commits intomainfrom
copilot/port-tests-from-vite-pr-16437

Conversation

Copy link
Contributor

Copilot AI commented Jan 29, 2026

Ports test coverage from #16437 for CJS modules with __esModule flag to ensure dev/build interop consistency with Rollup.

Changes

  • Test dependency: dep-cjs-with-es-module-flag - CommonJS module with __esModule: true
  • E2E tests: Static and dynamic import assertions in optimize-deps playground
  • Configuration: Added to optimizeDeps.include for prebundling coverage

Context

CJS modules compiled from ESM (via TypeScript, Babel, etc.) set __esModule: true to signal default export behavior. Vite's interop handling must match Rollup's to avoid runtime discrepancies between dev and prod.

Credits: @XiSenao

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • workers.cloudflare.com
    • Triggering command: /opt/hostedtoolcache/node/24.13.0/x64/bin/node /opt/hostedtoolcache/node/24.13.0/x64/bin/node --conditions node --conditions development --experimental-import-meta-resolve --require /home/REDACTED/work/vite/vite/node_modules/.pnpm/vitest@4.0.18_@types+node@22.19.7/node_modules/vitest/suppress-warnings.cjs /home/REDACTED/work/vite/vite/node_modules/.pnpm/vitest@4.0.18_@types+node@22.19.7/node_modules/vitest/dist/workers/forks.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 4 commits January 29, 2026 07:52
Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
Co-authored-by: sapphi-red <49056869+sapphi-red@users.noreply.github.com>
Copilot AI changed the title [WIP] Port tests from Vite pull request 16437 test: port CJS __esModule interop tests from #16437 Jan 29, 2026
Copilot AI requested a review from sapphi-red January 29, 2026 08:03
Co-authored-by: FinalAshen <819712530@qq.com>
@sapphi-red sapphi-red marked this pull request as ready for review January 29, 2026 12:29
@sapphi-red sapphi-red changed the title test: port CJS __esModule interop tests from #16437 test(optimizer): add CJS __esModule interop tests Jan 29, 2026
@sapphi-red sapphi-red merged commit a461932 into main Jan 29, 2026
33 of 34 checks passed
@sapphi-red sapphi-red deleted the copilot/port-tests-from-vite-pr-16437 branch January 29, 2026 12:43
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.

2 participants

Comments