Lesson 4.2

Project references and monorepos

Project references let one package depend on another package built output rather than its source, so the compiler can check and rebuild only what changed.

15mIntermediate12.2k students

Overview

Many small builds instead of one enormous one

Project references let one package depend on another package built output rather than its source, so the compiler can check and rebuild only what changed. On a large repository the difference is minutes.

They also enforce the dependency graph. A package that has not declared a dependency simply cannot import from it, which stops the slow slide into an implicit ball of mud.

The cost is discipline: every package needs its own config and correct references, and a missing one produces an error message that does not obviously say so.

In this lesson you will:

  • Split a large build into checkable units
  • Keep package boundaries honest
  • Speed up rebuilds with incremental output

Resources

Previous Lesson
Next Lesson
Project references and monorepos — TypeScript Deep Dive — Vertex