Skip to main content
Version: 3.x

Resolve dependency path

Use resolve when you need to know whether - and how - a file or package is reachable from your entry points. It prints the import paths that lead to the target.

rev-dep resolve --file src/utils/math.ts
rev-dep resolve --file src/utils/math.ts --entry-points src/index.ts
rev-dep resolve --module react --entry-points src/index.ts
rev-dep resolve --module node:fs --entry-points src/pages/index.tsx

Provide exactly one of --file (a project file) or --module (an npm package or a built-in module). A module is matched by the name as written in the import: --module fs finds fs and fs/promises imports, --module node:fs finds node:fs ones. When --entry-points is omitted, entry points are auto-detected.

This is one of the best commands for explaining unexpected reachability.

Useful flags​

rev-dep resolve --file src/utils/math.ts --all
rev-dep resolve --file src/utils/math.ts --compact-summary
rev-dep resolve --file src/utils/math.ts --graph-exclude '**/*.test.ts'
rev-dep resolve --module react --follow-monorepo-packages
  • --all shows every resolution path, not just the first one found per entry point.
  • --compact-summary prints a count of paths per entry point instead of the full paths.
  • --entry-points accepts multiple files or globs (-p for short).

To list what an entry point pulls in instead, use files.