circular dependency

Two or more pieces of code or data that depend on each other in a loop, so none can be built or resolved first.

In more detail

Circular dependencies make code hard to change, and tools that follow a chain of references must detect cycles or they would loop forever. Between modules, a cycle can mean one module sees another's exports before they are ready. Layered architectures avoid cycles by only allowing dependencies in one direction.

Example

The lesson's token resolver throws "Circular alias" after following more than five references.

Related terms

Taught in

References