Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: @defer requires the parent component also be standalone #55381

Open
andy-bond opened this issue Apr 17, 2024 · 0 comments
Open

docs: @defer requires the parent component also be standalone #55381

andy-bond opened this issue Apr 17, 2024 · 0 comments
Labels
area: docs Related to the documentation P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Milestone

Comments

@andy-bond
Copy link

andy-bond commented 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-loadable

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.

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 @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

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

@andy-bond 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
@pkozlowski-opensource pkozlowski-opensource added area: adev Angular.dev documentation area: docs Related to the documentation labels Apr 17, 2024
@ngbot ngbot bot added this to the needsTriage milestone Apr 17, 2024
@bencodezen bencodezen added the P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent label Apr 18, 2024
@ngbot ngbot bot modified the milestones: needsTriage, Backlog Apr 18, 2024
@JeanMeche JeanMeche removed the area: adev Angular.dev documentation label Apr 20, 2024
JeanMeche added a commit to JeanMeche/angular that referenced this issue Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: docs Related to the documentation P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

No branches or pull requests

4 participants