-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Turborepo globalEnv has 250+ entries, effectively defeating build caching for most contributors #28633
Description
Description
turbo.json currently lists over 250 environment variables in globalEnv. In Turborepo, any variable in globalEnv is included in the hash for every single task. Changing any one of those 250+ variables — or simply having it undefined vs. defined — invalidates the entire cache across all packages.
Impact
For self-hosted operators and new contributors, turbo almost never achieves cache hits between runs because:
- Their env differs from the last run (common in CI, after branch switches, or Docker restarts)
@calcom/web#buildadditionally re-declares 30+ of those same variables in its ownenvfield, creating double-hashing- Secrets like
STRIPE_PRIVATE_KEY,TWILIO_TOKEN,DAILY_API_KEYare inglobalEnvbut are unlikely to affect build output for most packages
The result: developers rebuild from scratch on nearly every run, making the monorepo DX significantly slower than it needs to be.
Proposed Fix
Audit the globalEnv list and move most entries to per-task env declarations. Only variables that genuinely affect all tasks should remain global:
NODE_ENVCIDATABASE_URL- A handful of others
Everything else should be scoped to the specific task/package that uses it. This is a straightforward but high-impact DX improvement.