Global Implicit Dependencies
Since v14.4, Nx supports inputs
and namedInputs
for setting up implicit dependencies. As of Nx v16, the implicitDependencies
defined in nx.json
are ignored and do not influence the affected graph. This field will be removed in v17. The implicitDependencies
in the project configuration are still the best way to manually set up a dependency between two projects that Nx is not able to detect automatically.
Projects Depending on Global Files
The old way to have the myapp
project depend on specific files in the root of the workspace was to use implicitDependencies
, like this:
{
"implicitDependencies": {
"globalConfig.js": ["myapp"],
"styles/**/*.css": ["myapp"]
}
}
To express the same dependencies with inputs
and namedInputs
, modify the default sharedGlobals
named input:
{
"namedInputs": {
"sharedGlobals": [
"{workspaceRoot}/globalConfig.js",
"{workspaceRoot}/styles/**/*.css"
],
"default": [
"sharedGlobals"
// etc
]
}
}
The sharedGlobals
are included in the default
named input, so most targets will be set up to depend on them.
For a more detailed explanation, read the Customizing Inputs and Named Inputs guide
Dependencies on Sections of the Root package.json
File
You used to be able to set up dependencies on specific packages in the dependencies
and devDependencies
sections of the package.json
file, like this:
{
"implicitDependencies": {
"package.json": {
"dependencies": "*",
"devDependencies": {
"mypackage": ["mylib"]
}
}
}
}
As of Nx 15, this is inferred automatically by Nx based on the import
statements in your code. These implicitDependencies
can be safely deleted.