angular-cli
angular-cli copied to clipboard
`ng serve` doesn't automatically recover if a component provided via NgModule disappears and then reappears
Command
serve (esbuild application builder)
Is this a regression?
I'm pretty sure not a recent regression. This behavior was also lately in the webpack build
Description
The title:
ng serve
doesn't automatically recover if a component provided via NgModule disappears and then reappears
This behavior means that if you switch your working branch and someone removed or moved a component from one NgModule to another, you must restart ng serve
to recover when you switch back or you are stuck with a bunch of errors of [ERROR] NG8001: 'app-foo' is not a known element
Minimal Reproduction
git clone [email protected]:sod/v18-ngmodule.git
v18-ngmodule
yarn install
ng serve
then remove the FooComponent
export in the Shared1Module
and add it back in. See how the error:
✘ [ERROR] NG8001: 'app-foo' is not a known element:
Won't go away until you change the component where <app-foo>
is actively used.
Video of reproduction:
https://github.com/angular/angular-cli/assets/905328/69be16cf-0f29-4936-adb8-3dfab20a86a4
Your Environment
Angular CLI: 18.0.0
Node: 20.11.1
Package Manager: yarn 1.22.19
OS: darwin arm64
Angular: 18.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1800.0
@angular-devkit/build-angular 18.0.0
@angular-devkit/core 18.0.0
@angular-devkit/schematics 18.0.0
@schematics/angular 18.0.0
rxjs 7.8.1
typescript 5.4.5
zone.js 0.14.6