Skip to content

Port TypeScript PR #62320: Allow --module commonjs --moduleResolution bundler#2757

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/port-commonjs-module-resolution
Draft

Port TypeScript PR #62320: Allow --module commonjs --moduleResolution bundler#2757
Copilot wants to merge 2 commits intomainfrom
copilot/port-commonjs-module-resolution

Conversation

Copy link
Contributor

Copilot AI commented Feb 11, 2026

Ports microsoft/TypeScript#62320. --moduleResolution bundler is now permitted with --module commonjs, since bundler resolution coherently resolves package.json "exports" conditions using "require" when emitting CommonJS.

  • internal/compiler/program.go: Uncommented the bundler+module compatibility check (previously gated behind // !!! Reenable once we don't map old moduleResolution kinds to bundler) and added moduleKind != core.ModuleKindCommonJS to the allow list alongside ModuleKindPreserve and non-Node ESM kinds.
  • Baselines: 4 .diff files deleted (Go output now matches TS reference exactly); 4 error baselines updated to emit TS5095 for node18/node20/nodenext + bundler combinations that remain disallowed.

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

… bundler

Uncomments and updates the bundler+module compatibility check in
verifyCompilerOptions() to allow ModuleKindCommonJS with bundler
moduleResolution. Updates the diagnostic to use the new message that
includes 'commonjs' in the allowed values list.

Updates 4 test baselines and removes 4 .diff files that are no longer
needed since Go output now matches TypeScript reference.

Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot AI changed the title [WIP] Port support for --module commonjs and --moduleResolution bundler Port TypeScript PR #62320: Allow --module commonjs --moduleResolution bundler Feb 11, 2026
Copilot AI requested a review from jakebailey February 11, 2026 06:34
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