What's the .angular directory in the project root about?

Viewed 7612

According to the docs, there's nothing called .angular being regarded. Yet, in my project, I get that directory, immediately in the root of the project (on the same level as e.g. package.json).

It wasn't there before because my .gitignore would've barked at it. Currently, I'm trying out the latest Angular version, 13.0 and I conclude that it's a new addition to the tooling. Probably, it's some temporary stuff, since its contents are the following.

  • .angular/cache/angular-webpack
  • .angular/cache/babel-webpack

It was pointless to google .angular directory dot what is and the only (semi-)relevant hit I got was the docs linked above.

What's up with .angular directory and do I need to care (and/or version control it)?

2 Answers

".angular/cache" folder should be ignored by your version control system (git, svn etc...)

Example for git, add this line to .gitignore file

.angular/cache

(source : ng new command with @angular/cli v13)

If you generated your project by using Angular CLI, those will be already included in your .gitignore file as below.

# Miscellaneous
/.angular/cache 

Caching is enabled by default in angular for the development environment. That's why you can see the .angular folder in the project root and of course it does not need to add in repo.

Enabling and disabling the cache

Caching is enabled by default. To disable caching run the following command:

ng config cli.cache.enabled false

To re-enable caching, set cli.cache.enabled to true.

Cache environments

By default, disk cache is only enabled for local environments.

To enable caching for all environments, run the following command:

ng config cli.cache.environment all

Related