Skip to content

fix: ncc build typescript 7 - #64

Merged
finalerock44 merged 3 commits into
mainfrom
fix/ncc-build-typescript-7
Oct 5, 2026
Merged

finalerock44 merged 3 commits into
mainfrom
fix/ncc-build-typescript-7

Conversation

@finalerock44

Copy link
Copy Markdown
Contributor

No description provided.

The TypeScript 7.0.2 bump (#60) broke `pnpm build`, so the Release
workflow's Rebuild dist job has failed on every push since, and
release-please (which needs it) hasn't run. ncc 0.45, the latest
release, compiles through TypeScript's JS compiler API (ts.sys), which
TypeScript 7, the native Go port, does not ship:

  TypeError: Cannot read properties of undefined (reading 'fileExists')
      at findConfigFile (.../@vercel/ncc/dist/ncc/loaders/ts-loader.js...)

Back to 5.9.3, the version before the bump. Dependabot now ignores
typescript >= 7 so it doesn't reopen the bump. Drop the ignore once ncc
supports TypeScript 7.
With TypeScript back on 5.9, ncc builds and exits 0, but dist/index.js
shrinks from 1.7 MB to 36 kB and fails on its first line:

  Error: Cannot find module '@actions/core'

@actions/core 3 (#58) and @actions/github 9 (#59) are ESM-only: their
`exports` have just an `import` condition. With "module": "commonjs",
TypeScript turns our imports into require() calls, webpack resolves
those with the `require` condition, finds nothing, and ncc bundles a
stub that throws at runtime rather than failing the build.

Emit ES modules ("module": "esnext") and resolve the way a bundler does
("moduleResolution": "bundler"), so webpack follows the `import`
condition. ncc still writes a CommonJS dist/index.js, so __dirname
(readWrapperVersion) still works. "lib" goes to es2022 for the
ErrorOptions type that @octokit/request-error now uses. That only
affects type checking, and node24 runs ES2022 natively.

Checked by running the old and new bundles with fake npx/npm on PATH.
Both build the same `dcd cloud` command from the same inputs and PR
event, report wrapper version 2.6.0, and write the same four
GITHUB_OUTPUT values. The new bundle requires the same Node builtins as
the old one. tsc --noEmit is now clean; under node10 resolution it could
not find @octokit/core/types.
CI only ran the unit tests, and that is all dependabot PRs get, so the
TypeScript 7 and @actions ESM bumps merged green and only failed in the
Release workflow after they landed on main. Run `pnpm build` in CI.

The build alone is not enough: ncc exits 0 when it can't resolve an
import, bundling a stub that throws "Cannot find module" when the action
runs. Fail when dist/index.js contains one (webpackMissingModule) and
list the modules it could not find.
@finalerock44 finalerock44 self-assigned this Oct 5, 2026
@finalerock44 finalerock44 changed the title Fix/ncc build typescript 7 fix: ncc build typescript 7 Oct 5, 2026
@finalerock44
finalerock44 merged commit ddeb78e into main Oct 5, 2026
3 of 4 checks passed
@finalerock44
finalerock44 deleted the fix/ncc-build-typescript-7 branch October 5, 2026 11:45
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