About
A Phantom Dependency is dependency used in a project:
- that is resolved (found)
- but is not declared as dependency in the project itself.
Example
If your project uses a dependency A that depends on B. The code of B is available.
If your project uses B without declaring it, B is a phantom dependency.
Technically, you shouldn't be able to use B without adding it to your project dependency but dependency manager may have a dependency resolution mechanism that allows it.
For instance:
- node require default function will search in all parent/sub directory
- the node manager puts all dependency under the same directory (node_modules)