Split a TypeScript codebase with tsconfig project references

8 steps · about 1 h 18 min · Intermediate

  1. Set up a tsconfig.json with extends and includes (doc, TypeScript, 10 min)

    Covers how config files are found, inherited and scoped to files.

  2. Link projects with references and tsc --build (guide, TypeScript, 20 min)

    The core guide to splitting one big program into fast, ordered builds.

  3. Mark a package as composite (reference, TypeScript, 5 min)

    Explains the constraints a referenced project must meet.

  4. Speed up rebuilds with incremental build info (reference, TypeScript, 5 min)

    Shows how .tsbuildinfo files let tsc skip unchanged work.

  5. Jump to source across packages with declaration maps (reference, TypeScript, 5 min)

    Keeps go-to-definition working in editors when packages consume built output.

  6. Map import aliases with paths (reference, TypeScript, 8 min)

    Explains what paths does and does not do at runtime.

  7. Run tsc with the right command-line flags (doc, TypeScript, 15 min)

    Lists build-mode flags like --verbose, --clean and --force for debugging builds.

  8. Start from a maintained base tsconfig (repo, TSConfig Bases, 10 min)

    Community bases give sensible defaults per runtime that projects can extend.