Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 41 additions & 7 deletions astro-docs/src/content/docs/reference/inputs.mdoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,28 @@ Source file inputs are defined like this:
```jsonc
// nx.json
Copy link
Contributor

@meeroslav meeroslav Nov 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should not be removed

Suggested change
// nx.json
// nx.json

{
"inputs": {
"{projectRoot}/**/*", // All files in a project
"{workspaceRoot}/.gitignore", // A specific file in the workspace
"{projectRoot}/**/*.ts", // A glob pattern for files
"!{projectRoot}/**/*.spec.ts", // Excluding files matching a glob pattern
"targetDefaults": {
"build": {
"inputs": [
"{projectRoot}/**/*", // All files in a project
"{workspaceRoot}/.gitignore", // A specific file in the workspace
"{projectRoot}/**/*.ts", // A glob pattern for files
"!{projectRoot}/**/*.spec.ts" // Excluding files matching a glob pattern
]
}
}
}
```

Source file inputs must be prefixed with either `{projectRoot}` or `{workspaceRoot}` to distinguish where the paths should be resolved from. `{workspaceRoot}` should only appear in the beginning of an input but `{projectRoot}` and `{projectName}` can be specified later in the input to interpolate the root or name of the project into the input location.
Source file inputs can be specified as strings with glob patterns. These patterns must be prefixed with either `{projectRoot}` or `{workspaceRoot}` to distinguish where the paths should be resolved from. `{workspaceRoot}` should only appear in the beginning of an input but `{projectRoot}` and `{projectName}` can be specified later in the input to interpolate the root or name of the project into the input location.

Alternatively, you can use the object format with the `fileset` property:

```jsonc
{
"inputs": [{ "fileset": "{projectRoot}/**/*" }]
}
```

#### Token Behavior with Nested Projects

Expand Down Expand Up @@ -155,7 +167,29 @@ The pattern will be matched with outputs of tasks which this task depends on. Se

When a root `tsconfig.json` or `tsconfig.base.json` is present, Nx will always consider parts of the file which apply to the project of a task being run.
This includes the full `compilerOptions` section and particular path mappings in the `compilerOptions.paths` property.
This allows Nx to to not invalidate every single task when a path mapping is added or removed from the root `tsconfig.json` file
This allows Nx to not invalidate every single task when a path mapping is added or removed from the root `tsconfig.json` file

### Named Inputs from Other Projects

You can reference named inputs from specific projects or from project dependencies using the object format with the `input` property:

```jsonc
{
"inputs": [
// Reference a named input from specific project(s)
{ "input": "production", "projects": "mylib" },
{ "input": "production", "projects": ["mylib", "myapp"] },

// Reference a named input from all project dependencies
{ "input": "production", "dependencies": true },

// Reference a named input from the current project (equivalent to just using the string)
{ "input": "production" }
Copy link
Member

@AgentEnder AgentEnder Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot These are equivalent to a syntactic sugar string form - production for the self input, and ^production for the dependencies one - Lets flip them to use the string, and the comment explain the equivalence

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in commit 54f6971 to use the string syntactic sugar forms ("production" and "^production") with comments explaining their equivalence to the object forms.

]
}
```

The `projects` property can be a string or an array of strings specifying which project(s) to reference the named input from. The `dependencies` property, when set to `true`, will reference the named input from all dependencies of the current project.

## Named Inputs

Expand Down