Skip to content

Switch tsconfig module resolution to bundler#682

Merged
truggeri merged 2 commits intomainfrom
tsconfig-module-resolution-bundler
Mar 26, 2026
Merged

Switch tsconfig module resolution to bundler#682
truggeri merged 2 commits intomainfrom
tsconfig-module-resolution-bundler

Conversation

@jeffwidman
Copy link
Copy Markdown
Member

Changes module from "commonjs" to "es2022" and moduleResolution from "node" to "bundler".

This tells TypeScript to resolve imports the way esbuild does, including support for package.json "exports" maps used by newer @actions/* and @octokit/* packages.

Since esbuild handles the actual CJS output (--format=cjs), these settings only affect type-checking — the runtime behavior is unchanged.

All 49 tests pass. tsc --noEmit clean.

@jeffwidman jeffwidman marked this pull request as ready for review March 26, 2026 05:07
@jeffwidman jeffwidman requested a review from a team as a code owner March 26, 2026 05:07
Comment thread tsconfig.json
"target": "es2022",
"module": "commonjs",
"moduleResolution": "node",
"module": "es2022",
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since target will soon change to es2024 (#680), I asked copilot about changing this to es2024 as well... but it said that typescript doesn't support that and es2022 is the latest stable value for this... since we don't want to jump to esnext.

Comment thread tsconfig.json
"module": "commonjs",
"moduleResolution": "node",
"module": "es2022",
"moduleResolution": "bundler",
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also asked Copilot if these two changes should be separate logical changes, or together, and it said they should go together because the default for bundler is node16 or something... so we need to specify both the resolution and the module to use since we want a non-default.

Changes module from "commonjs" to "es2022" and moduleResolution
from "node" to "bundler". This tells TypeScript to resolve imports
the way esbuild does, including support for package.json "exports"
maps used by newer @actions/* and @octokit/* packages.

Since esbuild handles the actual CJS output (--format=cjs), these
settings only affect type-checking — the runtime behavior is unchanged.
@jeffwidman jeffwidman force-pushed the tsconfig-module-resolution-bundler branch from 6c4c100 to 0ea234d Compare March 26, 2026 17:29
@truggeri truggeri merged commit bb56eeb into main Mar 26, 2026
9 checks passed
@truggeri truggeri deleted the tsconfig-module-resolution-bundler branch March 26, 2026 18:28
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