Overview
Therev-dep imported-by command finds and lists all files in the project that directly import the specified file. This is also known as finding “reverse dependencies” or “dependents.”
This is useful for understanding the impact of changes to a particular file. It answers the question: “What breaks if I change or delete this file?”
Usage
Flags
List of conditions for package.json imports resolution (e.g. node, imports, default)
Only display the count of importing files
Working directory for the command
Target file to find importers for
Enable resolution of imports from monorepo workspace packages. Pass without value to follow all, or pass package names
List the import identifiers used by each file
Path to package.json
Path to tsconfig.json
Show warnings and verbose output
Help for imported-by command
Examples
Find files importing a utility
Count importers
Show what’s being imported
Check imports across monorepo
Use custom paths
Use Cases
Impact analysis before changes
Impact analysis before changes
Before modifying a shared utility, see which files depend on it to assess the impact.
Safe deletion
Safe deletion
Check if a file has any importers before removing it. If the count is 0, it’s likely safe to delete.
Refactoring planning
Refactoring planning
When splitting or restructuring code, understand which files need to be updated.
Unused export detection
Unused export detection
Use
--list-imports to see which exports are actually being used, helping identify unused code.Tips
Related Commands
- resolve - Trace complete dependency paths between files
- files - List all files in an entry point’s dependency tree
- entry-points - Find files that aren’t imported by anything
