Command
build
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
22.0.x
Description
With #33321, the Angular CLI now shares build caches between Git worktrees. However, I'm not sure that it's working as expected with Angular projects that live in folders deeper than the root of the repo.
My repo is a C# solution with 3 web apps using Angular, which looks something like this:
- Solution/
- Site1/
- ClientApp/ (Angular project root)
- Site2/
- ClientApp/ (Angular project root)
- Site3/
- ClientApp/ (Angular project root)
After upgrading to Angular 22.1+, if I am on a Git worktree and build any of the Angular apps, the main repo gets new cache files at: `/.angular/cache//ClientApp/
Building the Angular projects in the main repo does not use the same cache. Those continue to use the caches at <repo root>/Site#/ClientApp/.angular/. Running ng cache info on an app in the main repo vs a worktree shows this discrepancy:
# From main repo folder
> npx ng cache info
Path : C:\Path\To\Solution\Site1\ClientApp\.angular\cache
# From worktree folder
> npx ng cache info
Path : C:\Path\To\Solution\.angular\cache
This feels unexpected for a few reasons:
- All three unrelated sites are using the same cache, since they are all called ClientApp (due to ASP.NET convention)
- The cache lives at the root of the main repo, even though there is no Angular project there
- The main repo doesn't use the same cache location as the worktrees
Minimal Reproduction
mkdir Solution
git init
ng new --skip-git
# use TestApp as app name for example
git add .
git commit -m "Initial commit"
git worktree add --detach ../Solution-worktree main
cd ../Solution-worktree/TestApp
npm i
npm run build
cd ../../Solution
git status
# Would expect no changes, but new untracked .angular folder with caches is present
Exception or Error
Your Environment
Angular CLI : 22.2.0
Angular : 22.2.0
Node.js : 24.19.0
Package Manager : npm 11.17.0
Operating System : win32 x64
┌───────────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────────┼───────────────────┼───────────────────┤
│ @angular-devkit/architect │ 0.2202.0 │ ^0.2202.0 │
│ @angular-devkit/build-angular │ 22.2.0 │ ^22.2.0 │
│ @angular-devkit/core │ 22.2.0 │ ^22.2.0 │
│ @angular/aria │ 22.2.0 │ ^22.2.0 │
│ @angular/build │ 22.2.0 │ ^22.2.0 │
│ @angular/cdk │ 22.2.0 │ ^22.2.0 │
│ @angular/cli │ 22.2.0 │ ^22.2.0 │
│ @angular/common │ 22.2.0 │ ^22.2.0 │
│ @angular/compiler │ 22.2.0 │ ^22.2.0 │
│ @angular/compiler-cli │ 22.2.0 │ ^22.2.0 │
│ @angular/core │ 22.2.0 │ ^22.2.0 │
│ @angular/forms │ 22.2.0 │ ^22.2.0 │
│ @angular/material │ 22.2.0 │ ^22.2.0 │
│ @angular/platform-browser │ 22.2.0 │ ^22.2.0 │
│ @angular/router │ 22.2.0 │ ^22.2.0 │
│ @angular/upgrade │ 22.2.0 │ ^22.2.0 │
│ rxjs │ 7.8.2 │ ~7.8.0 │
│ typescript │ 6.0.3 │ ~6.0.3 │
│ vitest │ 4.1.10 │ ^4.1.10 │
│ zone.js │ 0.15.1 │ ~0.15.0 │
Anything else relevant?
No response
Command
build
Is this a regression?
The previous version in which this bug was not present was
22.0.x
Description
With #33321, the Angular CLI now shares build caches between Git worktrees. However, I'm not sure that it's working as expected with Angular projects that live in folders deeper than the root of the repo.
My repo is a C# solution with 3 web apps using Angular, which looks something like this:
After upgrading to Angular 22.1+, if I am on a Git worktree and build any of the Angular apps, the main repo gets new cache files at: `/.angular/cache//ClientApp/
Building the Angular projects in the main repo does not use the same cache. Those continue to use the caches at <repo root>/Site#/ClientApp/.angular/. Running ng cache info on an app in the main repo vs a worktree shows this discrepancy:
This feels unexpected for a few reasons:
Minimal Reproduction
Exception or Error
Your Environment
Anything else relevant?
No response