You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On ng serve recompiling shows a repeated component declaration in same 2 modules: Type AppComponent is part of the declarations of 2 modules: AppModule and AppModule!
#18790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
In angular version 8.2.14 was working. The bug appears when I upgrade to Angular 10.1.1.
Description
After running first ng serve command the application works fine as it used to do. When the application it is modified at any point, and CLI recompile it, the application crash and it shows the following error in browser console:
Error: Type AppComponent is part of the declarations of 2 modules: AppModule and AppModule! Please consider moving AppComponent to a higher module that imports AppModule and AppModule. You can also create a new NgModule that exports and includes AppComponent then import that NgModule in AppModule and AppModule.
I have read that this error should appear in case the component is declared in two modules, but in the case it is saying that a component is being declared at the same module. This error is showed with all components at every module that is modified, this is just one of them.
🔬 Minimal Reproduction
I am unable to set a repository with the problem due to the complexity of it, but I insert here configuration files because I think they can be a clue to find the problem.
As it is mentioned before, the steps to reproduce it is just to run ng serve, and then force it to recompile at any point.
Error: Type AppComponent is part of the declarations of 2 modules: AppModule and AppModule! Please consider moving AppComponent to a higher module that imports AppModule and AppModule. You can also create a new NgModule that exports and includes AppComponent then import that NgModule in AppModule and AppModule.
at verifySemanticsOfNgModuleDef (core.js:25894)
at Function.get (core.js:25829)
at getInjectorDef (core.js:396)
at R3Injector.processInjectorType (core.js:11130)
at core.js:11002
at core.js:1135
at Array.forEach ()
at deepForEach (core.js:1135)
at new R3Injector (core.js:11002)
at createInjectorWithoutInjectorInstances (core.js:10976)
🐞 Bug report
Command (mark with an
x
)Is this a regression?
In angular version 8.2.14 was working. The bug appears when I upgrade to Angular 10.1.1.
Description
After running first ng serve command the application works fine as it used to do. When the application it is modified at any point, and CLI recompile it, the application crash and it shows the following error in browser console:
Error: Type AppComponent is part of the declarations of 2 modules: AppModule and AppModule! Please consider moving AppComponent to a higher module that imports AppModule and AppModule. You can also create a new NgModule that exports and includes AppComponent then import that NgModule in AppModule and AppModule.
I have read that this error should appear in case the component is declared in two modules, but in the case it is saying that a component is being declared at the same module. This error is showed with all components at every module that is modified, this is just one of them.
🔬 Minimal Reproduction
I am unable to set a repository with the problem due to the complexity of it, but I insert here configuration files because I think they can be a clue to find the problem.
As it is mentioned before, the steps to reproduce it is just to run ng serve, and then force it to recompile at any point.
tsconfig.app.json
tsconfig.json
AppModule
🔥 Exception or Error
🌍 Your Environment
Anything else relevant?
No
The text was updated successfully, but these errors were encountered: