Skip to content

fix(build): cache composite tsc .tsbuildinfo as a turbo output - #1767

Merged
os-zhuang merged 1 commit into
mainfrom
fix/turbo-cache-tsbuildinfo
Jun 15, 2026
Merged

fix(build): cache composite tsc .tsbuildinfo as a turbo output#1767
os-zhuang merged 1 commit into
mainfrom
fix/turbo-cache-tsbuildinfo

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

Problem

Follow-up to #1760 / #1766. Composite-tsc packages (composite: true — e.g. packages/app-shell, react, core, types, tenant, mobile) write incremental build state to <package>/tsconfig.tsbuildinfo at the package root. The build task in turbo.json only declared dist/**, .next/**, build/** as outputs, so the incremental build-info was:

  • not part of the cache hash, and
  • not cached/restored in sync with dist/.

A turbo cache hit restored dist/ but left whatever stale tsconfig.tsbuildinfo happened to be on disk; a build run against a desynced tsbuildinfo can under-emit (tsc believing the project is up-to-date), producing a partial dist/ that turbo then caches and replays — surfacing as TS2307: Cannot find module '@object-ui/app-shell' in consumers. (Observed while diagnosing #1760, when manually clearing dist/ but not the package-root tsbuildinfo.)

Fix

Add **/*.tsbuildinfo to the build task outputs so the incremental state is cached and restored atomically with dist/.

- "outputs": ["dist/**", ".next/**", "build/**"],+ "outputs": ["dist/**", ".next/**", "build/**", "**/*.tsbuildinfo"],

Scope / safety

  • CI fresh checkouts were already safe — *.tsbuildinfo is gitignored, so it's always absent on checkout → tsc always does a full emit. This change closes the local / warm-cache desync where a cache hit could pair a restored dist/ with a stale tsbuildinfo.
  • Outputs-only change; it cannot break the build itself — it only adds an additional cached artifact glob.

Verification

This is a one-line turbo.jsonoutputs addition (valid JSON, valid output glob). The authoritative check is CI's Bundle Analysis job (pnpm turbo run build --filter='./packages/*'), which runs the real turbo run build and must stay green. (Local turbo was unavailable in my worktree due to an unrelated install/platform-binary flake; CI is the source of truth for turbo behavior here.)

🤖 Generated with Claude Code

Composite-tsc packages (composite: true) write incremental state to
<package>/tsconfig.tsbuildinfo at the package root. turbo's `build` task only
declared dist/**/.next/**/build/** as outputs, so the incremental build-info was
neither hashed nor cached/restored in sync with dist. A turbo cache hit then
restored dist but left whatever stale tsbuildinfo happened to be on disk, and a
build run with a desynced tsbuildinfo could under-emit (e.g. tsc believing the
project is up-to-date), producing a partial dist that turbo would then cache and
replay — surfacing as `TS2307: Cannot find module '@object-ui/app-shell'` in
consumers.
Add **/*.tsbuildinfo to the `build` task outputs so incremental state is cached
and restored atomically with dist. CI fresh checkouts were already safe
(*.tsbuildinfo is gitignored → always a full emit); this closes the local /
warm-cache desync. Follow-up to #1760 / #1766.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercelBot commented Jun 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
objectuiIgnoredIgnoredJun 15, 2026 4:41pm

Request Review

@os-zhuang
os-zhuang merged commit ac2de16 into mainJun 15, 2026
9 checks passed
@os-zhuang
os-zhuang deleted the fix/turbo-cache-tsbuildinfo branch June 15, 2026 16:48
os-zhuang added a commit that referenced this pull request Jul 4, 2026
The build `outputs` glob `**/*.tsbuildinfo` (added in #1767 to cache
composite tsc .tsbuildinfo) also matched tsbuildinfo files reachable
through pnpm's workspace symlinks under `node_modules/@object-ui/*`.
Turbo cached those paths and, on cache restore, recreated them as real
directories — clobbering the pnpm symlinks. The workspace links
degraded into empty dirs holding only `tsconfig.tsbuildinfo` (plus
`.ignored_*` twins), so rolldown could no longer resolve
`@object-ui/i18n` et al. and `pnpm build` failed in @object-ui/runner.
Add `!**/node_modules/**` to the outputs so turbo never captures or
restores anything under node_modules, while still caching the
package-root `tsconfig.tsbuildinfo` that #1767 relies on.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for freeto 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

@os-zhuang