I know the concepts of lazy loading and sharing modules, but I'm not sure what will be the best practice of deviding code into modules in my app. I have 4 pages:
- Dashboard
- Drinks
- Drinks recipes
- Bars
So I divided my app into 4 logical, domain modules: DashboardModule
, DrinksModule
, RecipesModule
, BarsModule
. While coding I've noticed that I have some dependencies between modules:
DashboardModule
reuses some components from all other modules.BarsModule
andRecipesModule
reuse some components fromDrinksModule
So problems I see are:
- With
DashboardModule
all other modules must be loaded, but only some components are used. DrinksModule
is always loaded, but only some components are used in other modules.
I don't want to move all of that reused components to a single SharedModule
because these components fit the specific domain (like bar or drinks) and also some components will be loaded unnecessarily.
Is it sense to split these domain modules like DrinksModule
and SharedDrinksModule
and what will be the best project structure for that? Or maybe there is a better practice to handle these problems?