Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Core Concepts

Turbopack has these guiding principles:

Incremental

  • Avoid operations that require broad/complete graph traversal.
  • Changes should only have local effects.
  • Avoid depending on "global" information (information from the whole app).
  • Avoid "one to many" dependencies (depending on one piece of information from many sources).

Deterministic

  • Everything need to be deterministic.
  • Avoid randomness, avoid depending on timing.
  • Be careful with non-deterministic datastructures (like HashMap, HashSet).

Lazy

  • Avoid computing more information than needed for a given operation.
  • Put extra indirection when needed.
  • Use decorators to transform data on demand.

Extensible

  • Use traits.
  • Avoid depending on concrete implementations (avoid casting).
  • Make behavior configurable by passing options.

Simple to use

  • Use good defaults. Normal use case should work out of the box.
  • Use presets for common use cases.