App Router client modules: package `type: "commonjs"`/`"module"` overrides ignored
#1.504 geöffnet am 22. Mai 2026
Repository-Metriken
- Stars
- (8.120 Stars)
- PR-Merge-Metriken
- (Durchschn. Merge 1T 1h) (462 gemergte PRs in 30 T)
Beschreibung
This issue was created by an agent analysing CI failures from the Next.js Deploy Suite (vinext
mainvs Next.jsv16.2.6, 2026-05-22).
Problem
When a "use client" module imports a package whose package.json sets "type": "commonjs" (or "module") without an exports map, Next.js honors the type field. vinext always resolves the ESM build, so the rendered text mixes up cjs and esm markers.
Package with `type: "commonjs"` still resolved as ESM
Estimated Impact
~2 test failures across the deploy suite.
Affected Test Suites
test/e2e/app-dir/client-module-with-package-type/index.test.ts(2 failures)
Recommendation
-
Reproduce first in vinext's own test suite. Add fixtures importing two packages: one with
type: 'commonjs'and one withtype: 'module', both withoutexports. Assert each resolves correctly. -
Respect
typefield in the resolver. When there is noexportsmap, fall back totypefor choosing betweenmain(CJS) andmodule(ESM) entry.