0

my build command ng build --base-href /ProjectFolder/ --deploy-url /ProjectFolder/ --target=production

I am getting below given error, but ng serve is working fine also ng build for development environment is working fine

ERROR in : Type AddManagementAdjComponent in C:/My Drive/Git Project/Elixir/UI/src/app/Feature/add-management-adj/add-management-adj/add-management-adj.component.ts is part of the declarations of 2 modules: AddManagementAdjModule in C:/My Drive/Git Project/Elixir/UI/src/app/Feature/add-management-adj/add-management-adj.module.ts and AddManagementAdjModule in C:/My Drive/Git Project/Elixir/UI/src/app/Feature/add-management-adj/add-management-adj/add-management-adj.module.ts! Please consider moving AddManagementAdjComponent in C:/My Drive/Git Project/Elixir/UI/src/app/Feature/add-management-adj/add-management-adj/add-management-adj.component.ts to a higher module that imports AddManagementAdjModule in C:/My Drive/Git Project/Elixir/UI/src/app/Feature/add-management-adj/add-management-adj.module.ts and AddManagementAdjModule in C:/My Drive/Git Project/Elixir/UI/src/app/Feature/add-management-adj/add-management-adj/add-management-adj.module.ts. You can also create a new NgModule that exports and includes AddManagementAdjComponent in C:/My Drive/Git Project/Elixir/UI/src/app/Feature/add-management-adj/add-management-adj/add-management-adj.component.ts then import that NgModule in AddManagementAdjModule in C:/My Drive/Git Project/Elixir/UI/src/app/Feature/add-management-adj/add-management-adj.module.ts and AddManagementAdjModule in C:/My Drive/Git Project/Elixir/UI/src/app/Feature/add-management-adj/add-management-adj/add-management-adj.module.ts.

I was getting the same error for another component, I delete and recreate that component and error resolved for that particular component but now it is giving me the same error for other components and I cannot recreate all components because I have many such components, Please someone help me

2 Answers 2

1

From the error above "is part of the declarations of 2 modules" it seems AddManagementAdjComponent is declared in 2 NgModules, Please check , this May Helpp!!

Sign up to request clarification or add additional context in comments.

Comments

0

add-management-adj.component.ts is declared in multiple modules. The production build will pick up all the errors as it's building for optimization.

remove the component from the 2 modules and place within a shareable module or declare in your global module. Then rebuild, also no need for --target=production, just do --prod

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.