Skip to content

chore: migrate to ESM#20

Merged
usimd merged 1 commit into
mainfrom
chore/esm-migration
Jun 7, 2026
Merged

chore: migrate to ESM#20
usimd merged 1 commit into
mainfrom
chore/esm-migration

Conversation

@usimd

@usimd usimd commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Unblocks all failing major dependency bumps (#11, #12, #14).

Root cause: @actions/core v3, @actions/exec v3, and @actions/tool-cache v4 all dropped CJS support — their exports field only exposes "import". @vercel/ncc (webpack-based) can't bundle pure-ESM packages from a CJS context, causing the build step to fail for all three.

Changes:

  • Add "type": "module" to package.json
  • Update tsconfig.json: module/moduleResolutionnodenext, targetES2022
  • Replace require.main === module entry-point guard with import.meta.url equivalent
  • ncc now compiles to ESM (Compiling file index.js into ESM)

All 49 tests pass, build succeeds, lint clean.

Switch from CommonJS to ES modules to unblock major dependency upgrades.
@actions/core v3, @actions/exec v3, and @actions/tool-cache v4 all dropped
CJS support (exports field is import-only), which caused ncc to fail.

- Add "type": "module" to package.json
- Update tsconfig: module/moduleResolution -> nodenext, target -> ES2022
- Replace require.main === module guard with import.meta.url equivalent
- ncc now compiles to ESM (confirmed locally)
@usimd usimd merged commit 58f8f4e into main Jun 7, 2026
9 checks passed
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.

1 participant