Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
Yes
Description
When running the ng generate @angular/core:control-flow schematic on a large project, the migration tool incorrectly removes CommonModule from the component's imports: [] array, even though directives or pipes like async, date, and ngTemplateOutlet are still in use. This leads to runtime errors where these directives and pipes are no longer recognized in the template, but not fails the build
Please provide a link to a minimal reproduction of the bug
#59846 (comment)
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run ng version)
Angular CLI: 18.2.11
Node: 20.17.0
Package Manager: npm 10.8.2
OS: darwin arm64
Angular: undefined
...
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1802.11
@angular-devkit/build-angular 18.2.11
@angular-devkit/core 18.2.11
@angular-devkit/schematics 18.2.11
@angular/cli 18.2.11
@angular/compiler 18.2.10
@angular/compiler-cli 18.2.10
@angular/language-service 18.2.10
@schematics/angular 18.2.11
typescript 5.5.4
Anything else?
few notes:
- this bug only related to standalone components (our project is mixed)
- I suspect It might related to components were the template isn't changed (meaning already using the new control flow) - but has
CommonModule in the imports array - maybe in this edge case, the migration removes the CommonModule without check if other directives are used
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
Yes
Description
When running the
ng generate @angular/core:control-flowschematic on a large project, the migration tool incorrectly removesCommonModulefrom the component'simports: []array, even though directives or pipes like async, date, and ngTemplateOutlet are still in use. This leads to runtime errors where these directives and pipes are no longer recognized in the template, but not fails the buildPlease provide a link to a minimal reproduction of the bug
#59846 (comment)
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run
ng version)Anything else?
few notes:
CommonModulein the imports array - maybe in this edge case, the migration removes the CommonModule without check if other directives are used