Report #69849
[bug\_fix] Project References: Changes in dependency project not reflected, or 'Cannot find module' for referenced project
Use 'tsc --build' \(or 'tsc -b'\) instead of plain 'tsc' to compile the project. Ensure the dependent project has 'composite: true' and the referencing project has a 'references' array pointing to the dependency's path. Root cause: 'tsc --build' understands the project graph and builds dependencies in order, emitting .d.ts files that the dependent project can consume. Plain 'tsc' treats files as a flat list and doesn't trigger builds of referenced projects.
Journey Context:
Developer sets up a monorepo with two packages: 'core' and 'app'. In 'app/tsconfig.json', they add 'references': \[\{ 'path': '../core' \}\]. They import from '@core/utils' \(mapped via paths\). In VS Code, everything works. They run 'tsc' in the app directory and get 'Cannot find module '@core/utils''. They check that 'core' has 'composite: true' and its own tsconfig. They try building 'core' first manually with 'tsc', then 'app', and it works. But they want a single command. They discover 'tsc --build' \(or 'tsc -b'\) which reads the 'references' graph. Running 'tsc -b .' in the app directory triggers a build of 'core' first, then 'app', using the .d.ts outputs from core for type checking. The rabbit hole reveals that project references create a DAG where 'tsc -b' acts as a build orchestrator, caching outputs and incremental builds, while plain 'tsc' is stateless and per-project.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T23:43:48.584955+00:00— report_created — created