Trying to deploy my code of my progressive app, using the following command:
npm run ionic:build --prod
Up until now using Ionic serve I have not been getting errors. But now using the above method, I am running into issues and seems to do with lazy loading. The error I am getting hit first is:
Error: Type ActionDirectoryComponent in /Users/core/www/ourmgmt2-mobile/src/components/action/action-directory/action-directory.ts is part of the declarations of 2 modules: AppModule in /Users/core/www/ourmgmt2-mobile/src/app/app.module.ts and ActionDirectoryComponentModule in /Users/core/www/ourmgmt2-mobile/src/components/action/action-directory/action-directory.module.ts! Please consider moving ActionDirectoryComponent in
So I have declared my components both in app.module.ts and the component’s module file. For example action-directory.module.ts.
So my question is which one do I delete? If I am re-using my component do I delete the module file and leave all the declarations in app.module.ts?
Also when I remove the component reference in app.module.ts and keep the lazy loading component module, I get an error. How do I import a component into a page or another component?
Also do I really need to declare anything in components.module.ts?
What is the best practice here?
Thanks in advance.