Skip to content

Migrate to ES Modules with Rollup#825

Merged
shogo82148 merged 3 commits intomasterfrom
copilot/migrate-to-es-modules
Mar 14, 2026
Merged

Migrate to ES Modules with Rollup#825
shogo82148 merged 3 commits intomasterfrom
copilot/migrate-to-es-modules

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 14, 2026

Migrates the build toolchain from CommonJS + @vercel/ncc to ES Modules + Rollup, following shogo82148/typescript-action#433.

Build

  • Replace @vercel/ncc with rollup + @rollup/plugin-{commonjs,node-resolve,typescript,json}
  • Output as CJS (dist/index.cjs) — required because transitive deps (@actions/cache, @actions/tool-cache, undici, etc.) contain dynamic require() calls that rollup can't statically convert; .cjs is always loaded as CommonJS by Node.js regardless of "type": "module"
  • action.yml updated to main: "dist/index.cjs"

TypeScript / module config

  • Add tsconfig.base.json: NodeNext module resolution, ES2022 target
  • Add tsconfig.eslint.json: extends base with isolatedModules: true, noEmit: true — used by Jest and ESLint
  • tsconfig.json now extends base, outputs to ./dist
  • All local imports use .js extensions (required by NodeNext)

Source

  • src/index.ts is the new action entrypoint; calls run() exported from src/main.ts
  • src/main.ts exports run() instead of invoking it directly

Tests

  • jest.config.js converted to ESM (export default), useESM: true, ts-jest-resolver
  • cross-env added so NODE_OPTIONS=--experimental-vm-modules works on Windows
  • __dirname usage in __test__/installer.test.ts replaced with import.meta.url

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI changed the title [WIP] Migrate project to ES Modules Migrate to ES Modules with Rollup Mar 14, 2026
Copilot AI requested a review from shogo82148 March 14, 2026 14:48
@shogo82148 shogo82148 marked this pull request as ready for review March 14, 2026 16:39
@shogo82148 shogo82148 merged commit 381df10 into master Mar 14, 2026
36 of 37 checks passed
@shogo82148 shogo82148 deleted the copilot/migrate-to-es-modules branch March 14, 2026 17:27
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