How the Project Graph is Built
Nx creates a graph of all the dependencies between projects in your workspace using two sources of information:
Package dependencies defined in the
package.json
file for each project.If the
myapp/package.json
file has this dependency:myapp/package.json{ "dependencies": { "@myorg/awesome-library": "*" } }
Then
my-app
depends onawesome-library
.Note: We typically use
*
for the dependency instead of a specific version because we want to depend on the version of the library as it currently exists in the repo.Typescript
import
statements referencing a particular project's path aliasFor instance, if a file in
my-app
has this code:import { something } from '@myorg/awesome-library';
Then
my-app
depends onawesome-library
This can be turned on or off with the
analyzeSourceFiles
flag.Manually created
implicitDependencies
in the project configuration file.If your project configuration has this content:
{
"name": "myapp",
"nx": {
"implicitDependencies": ["some-api"]
}
}
Then my-app
depends on some-api
.
Related Documentation
Recipes
- Project Graph Plugins
- Disable Graph Links Created from Analyzing Source Files
- Export Project Graph
- Resolve Circular Dependencies