Skip to content

feat(build): enable TypeScript incremental compilation across monorepo - #347

Merged
Lakes41 merged 1 commit into
Adamantine-guild:mainfrom
Emelie-Dev:fix/issue-incremental-builds
Aug 19, 2026
Merged

feat(build): enable TypeScript incremental compilation across monorepo#347
Lakes41 merged 1 commit into
Adamantine-guild:mainfrom
Emelie-Dev:fix/issue-incremental-builds

Conversation

@Emelie-Dev

Copy link
Copy Markdown
Contributor

Description

This PR tackles the slow TypeScript build times in the monorepo by enabling true incremental compilation across all packages and leveraging TypeScript project references (tsc -b).

Problem

Previously, pnpm -r build would sequentially compile all apps and packages entirely from scratch. With zero cache strategy or dependency awareness, modifying a single file could result in 30+ seconds of full workspace rebuilds, bottlenecking iteration cycles.

Solution

  1. Incremental Base Configuration:
    Updated tsconfig.base.json to use incremental: true, set tsBuildInfoFile to keep the root directory clean, and enabled composite: true for downstream dependencies.
  2. Project References:
    Introduced a new root tsconfig.json that hooks into all Next.js apps, TypeScript packages, and utilities using native TypeScript project references.
  3. Build Script Enhancements:
    Replaced the basic builder with dependency-aware tsc -b via package.json, along with a robust build:clean utility for deep wipeouts.
  4. Housekeeping:
    Added the generated .tsbuildinfo cache files to .gitignore and documented the caching mechanism in the README.md for team visibility.

Related Issue

Fixes: [Link the original issue here]

Testing and Benchmarks

  • First Run: pnpm -r build or pnpm build — A full compile executes, generating .tsbuildinfo locally in each project.
  • Subsequent Runs: After modifying a file, pnpm build will accurately compile only the affected references. You should see times dramatically drop from ~30s+ down to <5 seconds.

closes #337

@Lakes41
Lakes41 merged commit a31198f into Adamantine-guild:main Aug 19, 2026
1 check 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.

Implement incremental TypeScript compilation and caching for monorepo builds

2 participants