You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had made my "target" component standalone: true and the only reference to it was inside that @defer block in the "parent" component.
I was confused as to why I wasn't seeing a bundle being generated for the component I deferred. I was given a hint by someone on my team that the parent also has to be standalone for it to @defer correctly!
I don't think the documentation is very clear that not only does the "target" component need to be standalone, but also the parent must be standalone.
Describe what you were looking for in the documentation
Clear reasons why a chunk I expected to be @defered wasn't being split off.
Describe the actions that led you to experience the problem
I created a standalone: true component
I put it in an @defer block in a parent (that was declared in NgModule)
My deferred block wasn't split into a separate chunk
Describe what you want to experience that would fix the problem
I would definitely like more clear documentation on what the requirements are to @defer a component.
Additionally, I think it would be helpful to potentially have a console warning (in dev mode) to indicate why something in an @defer block is not being split. This would be nice, but not a requirement :)
Add a screenshot if that helps illustrate the problem
If this problem caused an exception or error, please paste it here
No response
If the problem is browser-specific, please specify the device, OS, browser, and version
No response
Provide any additional information here in as much as detail as you can
No response
The text was updated successfully, but these errors were encountered:
andy-bond
changed the title
docs: @defer requires the parent component must be standalone
docs: @defer requires the parent component also be standalone
Apr 17, 2024
Describe the problem that you experienced
When attempting to use
@defer
I found myself confused after reading the documentation: https://angular.dev/guide/defer#which-dependencies-are-defer-loadableI had made my "target" component
standalone: true
and the only reference to it was inside that@defer
block in the "parent" component.I was confused as to why I wasn't seeing a bundle being generated for the component I deferred. I was given a hint by someone on my team that the parent also has to be standalone for it to
@defer
correctly!I don't think the documentation is very clear that not only does the "target" component need to be standalone, but also the parent must be standalone.
Enter the URL of the topic with the problem
Describe what you were looking for in the documentation
Clear reasons why a chunk I expected to be
@defer
ed wasn't being split off.Describe the actions that led you to experience the problem
standalone: true
component@defer
block in a parent (that was declared in NgModule)Describe what you want to experience that would fix the problem
I would definitely like more clear documentation on what the requirements are to
@defer
a component.Additionally, I think it would be helpful to potentially have a console warning (in dev mode) to indicate why something in an
@defer
block is not being split. This would be nice, but not a requirement :)Add a screenshot if that helps illustrate the problem
Stackblitz example: https://stackblitz.com/edit/stackblitz-starters-kzxukv?file=package.json
If this problem caused an exception or error, please paste it here
No response
If the problem is browser-specific, please specify the device, OS, browser, and version
No response
Provide any additional information here in as much as detail as you can
No response
The text was updated successfully, but these errors were encountered: