Search code examples
angularangular13

Can't ignore /.angular/cache in new Angular 13 project


I created a project from scratch that uses Angular 13. I can't seem to be able to get the angular cache to be ignored so that these files won't be included in source control.

I've tried adding all the following to .gitnore .angular, /.angular/cache, .angular/cache, *.angular/cache but none of these worked. When I run npm start, I still get the cache changes getting tracked.

This is how my file directory structure looks like

enter image description here

This is output from npm start: enter image description here


Solution

  • It seems to me that your cache files were already added in a previous commit. The changelog in your VSCode screenshot shows that the committed cached files are being removed (hence the red D on the right).

    Here are two options for you:

    1. Commit these changes as is, and the files will be removed and untracked from the repo (but they'll still be in your commit history when they were added).

    2. Undo the commit where these files were added. Then update your .gitignore where you only add the .angular directory.