Skip to main content

Overview

The rev-dep resolve command analyzes and displays the dependency chain between specified files. This helps you understand how different parts of your codebase are connected and why a particular file is included in an entry point’s bundle.

Usage

rev-dep resolve [flags]

Flags

-a, --all
boolean
Show all possible resolution paths, not just the first one
--compact-summary
boolean
Display a compact summary of found paths
--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
-p, --entry-points
string[]
Entry point file(s) or glob pattern(s) to start analysis from (default: auto-detected)
-f, --file
string
Target file to check for dependencies
--follow-monorepo-packages
string[]
Enable resolution of imports from monorepo workspace packages. Pass without value to follow all, or pass package names
--graph-exclude
string[]
Glob patterns to exclude files from dependency analysis
-t, --ignore-type-imports
boolean
Exclude type imports from the analysis
--module
string
Target node module name to check for dependencies
--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 resolve command

Examples

Find path between entry point and file

rev-dep resolve -p src/index.ts -f src/utils/helpers.ts
This shows the import chain from src/index.ts to src/utils/helpers.ts.

Find all paths to a file

rev-dep resolve -p src/index.ts -f src/utils/helpers.ts --all
Useful when a file is imported through multiple paths.

Check if a module is used

rev-dep resolve -p src/index.ts --module lodash
Shows how the lodash module is reached from your entry point.

Use glob pattern for entry points

rev-dep resolve -p "src/pages/**/*.tsx" -f src/components/Button.tsx
Finds which pages use a specific component.

Compact summary view

rev-dep resolve -p src/index.ts -f src/utils/helpers.ts --compact-summary

Exclude test files from path analysis

rev-dep resolve -p src/index.ts -f src/utils/helpers.ts --graph-exclude="**/*.test.ts"

Use Cases

When a file appears in your bundle unexpectedly, use this command to trace how it’s being imported.
Before moving or removing a file, understand all the import paths that lead to it.
Identify why a heavy dependency is being included in your bundle.
Use with --all to see all paths between files involved in circular dependencies.
  • imported-by - List files that directly import a target file
  • files - List all files in an entry point’s dependency tree
  • circular - Detect circular dependencies

Build docs developers (and LLMs) love