- Notifications
You must be signed in to change notification settings - Fork2.6k
Description
Current Behavior
Targets that depend on other projects are still served from cache even when their dependencies are recomputed.
The target below depends onbuild from its dependencies. If changes occur in a dependency that invalidates the cache the dependency is rebuilt, but not the base target resulting in cached output using old code.
"build": {"cache":true,"dependsOn": ["^build"],"inputs": ["project"],"outputs": ["{projectRoot}/built/**"],"executor":"nx:run-commands","options": {"cwd":"{projectRoot}","command":"vite build" }}
Se full description in readme:https://github.com/rudfoss-rr/nx-cache-dependson-issue/blob/main/README.md
Expected Behavior
If a dependency is declared in a target usingdependsOn and that dependency is invalidated, it should also invalidate the source target.
projectA:build -> libraryA:build -> libraryB:buildIf everything is initially cached and then a change occurs in libraryB that invalidates thelibraryB:build target then the cache forprojectA:build andlibraryA:build should also be invalidated.
GitHub Repo
https://github.com/rudfoss-rr/nx-cache-dependson-issue
Steps to Reproduce
See attached repository.
Nx Report
NX Reportcomplete - copy this into the issue templateNode: 24.11.0OS: linux-x64Native Target: x86_64-linuxpnpm: 10.18.3nx: 22.0.2@nx/js: 22.0.2@nx/workspace: 22.0.2@nx/devkit: 22.0.2typescript: 5.9.3---------------------------------------Cache Usage: 0.00 B / 100.69 GB
Failure Logs
N/A
Package Manager Version
pnpm 10.18.3
Operating System
- macOS
- Linux
- Windows
- Other (Please specify)
Additional Information
I'm unable to determine if this is expected behavior or an actual bug. It seems to me that this is incorrect behavior as the onlyworkaround I've found requires that each target knows which inputs affect the cache of the dependency chain all the way up to the top.