Skip to content

fix(build): patch tsup dts cache bug that ran release builds out of memory - #1202

Merged
LinuxDevil merged 1 commit into
mainfrom
fix/tsup-dts-memory
Nov 18, 2026
Merged

LinuxDevil merged 1 commit into
mainfrom
fix/tsup-dts-memory

Conversation

@LinuxDevil

Copy link
Copy Markdown
Owner

The Release workflow for 1.0.0-alpha.131 failed with ERR_WORKER_OUT_OF_MEMORY during the declaration build.

Cause: in tsup/dist/rollup.js, getCompilerOptions keeps the input file's folder as dirName on a cache hit when a tsconfig path is passed (tsup always passes one). The dts plugin compares dirName to decide whether it can reuse its TypeScript program, so it builds a fresh program for every source folder. Memory grows with the number of folders, and the Profile PR's new integration folders pushed it past 12 GB. PR CI builds with --no-dts, so only the release hit it.

Fix: scripts/patch-tsup.mjs applies the one-line fix before npm run build. It is idempotent and fails loudly if a tsup upgrade moves the code. No new dependency.

Checked locally: full build passes in ~10s at ~1.3 GB peak (was >12 GB). npm run api:check: all 26 reports unchanged, so the published declarations are identical.

🤖 Generated with Claude Code

…emory

tsup's getCompilerOptions keeps the input folder as dirName on a cache hit when a tsconfig path is passed, so rollup-plugin-dts builds a new TypeScript program per source folder. The release build of 1.0.0-alpha.131 hit the 12 GB heap limit. With the fix the declaration build takes ~9s and ~1.3 GB; API reports are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@lousho-ai lousho-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approving.

@LinuxDevil
LinuxDevil merged commit ac9273f into main Nov 18, 2026
6 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