angular / angular/angular-cli

Changes will no longer be recognized if you remove and re-add same component

Abierto
#28,956 0 comentarios 0 reacciones 0 asignados Ver en GitHub
angular/build:application area: @angular/build freq1: low severity5: regression type: bug/fix
Lenguaje dominante
TypeScript
Estrellas
27k
Forks
11.8k
Merge medio
14 h 23 min
PR fusionados (30 d)
162

Descripción

### Command

serve

### 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

_No response_

### Description

Changes will no longer be recognized if you remove and re-add same component.

### Minimal Reproduction

Removing and re-adding the import of the component (`import { TestComponent } from ‘./test/test.component’`), the component in the `imports` array and in the template (``) leads to that no further changes to this component are recognized.

![Image](https://github.com/user-attachments/assets/cfacaddc-4f00-4196-b4b4-cf69622cfe42)

[Repro App V18](https://stackblitz.com/edit/stackblitz-starters-py5tnk?file=src%2Ftest%2Ftest.component.ts,src%2Fmain.ts)

[Problem also in V19](https://stackblitz.com/edit/stackblitz-starters-2h7zbv?file=src%2Ftest%2Ftest.component.ts,src%2Fmain.ts)

### Exception or Error

```text

```

### Your Environment

```text
**v18 Reproduction environment:**
Angular CLI: 18.2.12
Node: 18.20.3
Package Manager: npm 10.2.3
OS: linux x64

Angular: 18.2.12
... animations, build, cli, common, compiler, compiler-cli, core
... forms, platform-browser, router

Package Version
------------------------------------------------------
@angular-devkit/architect 0.1802.12
@angular-devkit/core 18.2.12 (cli-only)
@angular-devkit/schematics 18.2.12
@schematics/angular 18.2.12
rxjs 7.8.1
typescript 5.5.4
zone.js 0.14.10

**v19 Reproduction environment:**
Angular CLI: 19.0.0
Node: 18.20.3
Package Manager: npm 10.2.3
OS: linux x64

Angular: 19.0.0
... animations, build, cli, common, compiler, compiler-cli, core
... forms, platform-browser, router

Package Version
------------------------------------------------------
@angular-devkit/architect 0.1900.0
@angular-devkit/core 19.0.0
@angular-devkit/schematics 19.0.0
@schematics/angular 19.0.0
rxjs 7.8.1
typescript 5.6.3
zone.js 0.15.0
```

### Anything else relevant?

After clearing the Angular cache with `ng cache clean` and restarting the dev server with `ng serve` it works again.
So probably a caching bug.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Empieza con las reproducciones de StackBlitz enlazadas y ejecuta el comando `serve` usando la secuencia de quitar y volver a añadir descrita en el issue. Compara el comportamiento antes y después de `ng cache clean`; se considera terminado cuando los cambios posteriores en el componente vuelto a añadir se reconocen sin borrar la caché de Angular ni reiniciar el servidor de desarrollo.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
angular, typescript
Área
build-system, tooling
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.