angular / angular/angular-cli

Add configurable size limit for persistent build cache with LRU eviction

Aberta
#33,320 4 comentários 0 reações 0 responsáveis Ver no GitHub
area: @angular/cli gemini-triaged needs: more info
Linguagem predominante
TypeScript
Estrelas
27k
Forks
11.8k
Merge médio
14h 23min
PRs com merge (30d)
162

Descrição

### Command

build, serve

### Description

The Angular CLI persistent disk cache (`.angular/cache`) grows without bounds. On large projects, a single checkout accumulates tens of gigabytes of cached build artifacts. In our case, a single checkout reached **29 GB**.

This was previously raised in #25116 and closed as not feasible with Webpack. Since Angular 17+, the build system uses esbuild, so the original constraint no longer applies.

### Describe the solution you'd like

Add a configurable size cap (e.g., `cli.cache.maxSize`) with LRU eviction when the limit is reached. This is a common pattern in build tooling — Turborepo, Gradle, and most browsers' HTTP caches all implement bounded persistent caches.

Example configuration:
```json
"cli": {
"cache": {
"enabled": true,
"maxSize": "2GB"
}
}
```

When the cache exceeds `maxSize`, the oldest/least-recently-used entries are evicted.

### Describe alternatives you've considered

- Periodically running `ng cache clean` or manually deleting `.angular/cache` — works but is a manual maintenance burden, especially for developers unaware the cache is growing.

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

Comece pelo cache persistente usado pelos comandos `build` e `serve` e compare-o com o ponto de entrada existente `ng cache clean` para `.angular/cache`. Defina como `cli.cache.maxSize` é configurado e medido e, em seguida, verifique se as entradas usadas menos recentemente são removidas quando o limite configurado é excedido.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
angular, typescript
Domínio
build-system, cli
Tipo de issue
Funcionalidade
Dificuldade
5/5
Tempo estimado
Mais de uma semana
Status de atividade
Ativa
Clareza
Razoavelmente clara
Facilidade para iniciantes
45/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.