Angular · Senior · Question 31 of 75
Why might a component inside @defer still end up in the main bundle?
- ✓Correct answer: It is also referenced outside the defer block in the same file (e.g. in imports used elsewhere or a
viewChildquery) - 2Standalone components can never be deferred
- 3
@deferonly works in production builds
Explanation
Dependencies of a defer block must be standalone and used only inside it. Any eager reference forces the compiler to load them eagerly.