Skip to main content

Overview

The rev-dep circular command analyzes your project to find circular dependencies between modules. Circular dependencies can cause hard-to-debug issues and should generally be avoided. A circular dependency occurs when a file directly or indirectly imports itself through a chain of imports. While this can lead to unpredictable runtime behavior, uninitialized values, or subtle bugs, circular dependencies between TypeScript type-only imports are usually harmless.

Usage

rev-dep circular [flags]

Flags

--condition-names
string[]
List of conditions for package.json imports resolution (e.g. node, imports, default)
-c, --cwd
string
default:"$PWD"
Working directory for the command
-t, --ignore-type-imports
boolean
Exclude type imports from the analysis
--follow-monorepo-packages
string[]
Enable resolution of imports from monorepo workspace packages. Pass without value to follow all, or pass package names
--package-json
string
default:"./package.json"
Path to package.json
--tsconfig-json
string
default:"./tsconfig.json"
Path to tsconfig.json
-v, --verbose
boolean
Show warnings and verbose output
-h, --help
boolean
Help for circular command

Examples

Basic circular dependency detection

rev-dep circular

Ignore type imports

rev-dep circular --ignore-type-imports
This is useful when you want to focus only on runtime circular dependencies, since TypeScript type-only circular imports are typically harmless.

Check specific working directory

rev-dep circular --cwd ./packages/core

Use with monorepo

rev-dep circular --follow-monorepo-packages

Build docs developers (and LLMs) love