Port TypeScript PR #62320: Allow --module commonjs --moduleResolution bundler#2757
Draft
Port TypeScript PR #62320: Allow --module commonjs --moduleResolution bundler#2757
Conversation
… 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports microsoft/TypeScript#62320.
--moduleResolution bundleris 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 addedmoduleKind != core.ModuleKindCommonJSto the allow list alongsideModuleKindPreserveand non-Node ESM kinds..difffiles 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.