feat(build): enable TypeScript incremental compilation across monorepo - #347
Merged
Lakes41 merged 1 commit intoAug 19, 2026
Merged
Conversation
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 buildwould 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
Updated
tsconfig.base.jsonto useincremental: true, settsBuildInfoFileto keep the root directory clean, and enabledcomposite: truefor downstream dependencies.Introduced a new root
tsconfig.jsonthat hooks into all Next.js apps, TypeScript packages, and utilities using native TypeScript project references.Replaced the basic builder with dependency-aware
tsc -bviapackage.json, along with a robustbuild:cleanutility for deep wipeouts.Added the generated
.tsbuildinfocache files to.gitignoreand documented the caching mechanism in theREADME.mdfor team visibility.Related Issue
Fixes: [Link the original issue here]
Testing and Benchmarks
pnpm -r buildorpnpm build— A full compile executes, generating.tsbuildinfolocally in each project.pnpm buildwill accurately compile only the affected references. You should see times dramatically drop from ~30s+ down to <5 seconds.closes #337