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:

1{ 2 "implicitDependencies": { 3 "globalConfig.js": ["myapp"], 4 "styles/**/*.css": ["myapp"] 5 } 6} 7

To express the same dependencies with inputs and namedInputs, modify the default sharedGlobals named input:

1{ 2 "namedInputs": { 3 "sharedGlobals": [ 4 "{workspaceRoot}/globalConfig.js", 5 "{workspaceRoot}/styles/**/*.css" 6 ], 7 "default": [ 8 "sharedGlobals" 9 // etc 10 ] 11 } 12} 13

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:

1{ 2 "implicitDependencies": { 3 "package.json": { 4 "dependencies": "*", 5 "devDependencies": { 6 "mypackage": ["mylib"] 7 } 8 } 9 } 10} 11

As of Nx 15, this is inferred automatically by Nx based on the import statements in your code. These implicitDependencies can be safely deleted.