I'm dealing with a situation where I have a large module but only need to export one specific component. I'm wondering if Angular loads the entire module or just the exported components, as I want to optimize performance without compromising the project's structure by moving the component to a common module. Any advice on how to approach this?
To illustrate, let's consider ModuleA which contains 3 components but exports only ComponentA:
@NgModule({
// ...
exports: [
ComponentA
],
declarations: [
ComponentA,
ComponentB,
ComponentC
]
})
export class ModuleA { }
In ModuleB, I import ModuleA to utilize ComponentA:
@NgModule({
// ...
imports: [
ModuleA
]
})
export class ModuleB { }
My question is, when ModuleB is loaded, does it load all components from ModuleA or just ComponentA?