-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Closed
Labels
area: migrationsIssues related to `ng update`/`ng generate` migrationsIssues related to `ng update`/`ng generate` migrationscross-cutting: standaloneIssues related to the NgModule-less worldIssues related to the NgModule-less worldstate: has PR
Milestone
Description
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
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
CommonModulein the imports array - maybe in this edge case, the migration removes the CommonModule without check if other directives are used
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: migrationsIssues related to `ng update`/`ng generate` migrationsIssues related to `ng update`/`ng generate` migrationscross-cutting: standaloneIssues related to the NgModule-less worldIssues related to the NgModule-less worldstate: has PR