is it normal that touching one shared package rebuilds all 14 apps in ci Turborepo
First time working in a monorepo, six months in and I still cannot tell what is a design decision and what is a mistake nobody has fixed.
We have a @acme/utils package that basically everything depends on. If I change one function in it, CI builds and tests all 14 apps. That is 22 minutes. If I change a file in one app it is 90 seconds.
My instinct says the 22 minutes is correct - I did change something everything depends on. But it also means the smallest possible edit to that package costs me half an hour and people have started avoiding touching it, which seems worse than the build time.
Is this just what monorepos are, or is something set up wrong?
@dartfit_dana · 7mo ago · 2 replies
Half right. Rebuilding everything downstream is correct and you do not want to change it - that is the whole point of the dependency graph and it is what stops you shipping a broken app because you changed a utility.
The part that is not normal is that it costs 22 minutes of wall clock every time. Two things fix that without giving up correctness:
@acme/utilschanges, everything downstream genuinely does need rebuilding, but on a PR that touches one app, the other 13 should cost a few seconds each. If they do not, your caching is broken and that is the actual bug.runs tests for changed packages and everything that depends on them, and skips the rest. On a utils change that is still most of the repo, but on the 90% of PRs that touch one app it is a fraction.
The fact that people are avoiding the shared package is the real signal here. That is a build system problem turning into a code quality problem, and it always ends with three slightly-different copies of the same helper.
Reply
Report
@carryon_only · 7mo ago
We do not have remote caching at all. Everything is built from scratch on every run. Suddenly the 22 minutes makes a lot more sense as a symptom rather than a fact of life.
Reply
Report