feat(animations): Provide a way to lazy load the animations#50738
feat(animations): Provide a way to lazy load the animations#50738JeanMeche wants to merge 3 commits intoangular:mainfrom
Conversation
1e600bb to
9eb4b94
Compare
9eb4b94 to
bc81f84
Compare
22e43cc to
a3b6b41
Compare
7456abb to
c773b6c
Compare
7766964 to
52424c2
Compare
a76ee9c to
5b8836b
Compare
7acd70a to
62da920
Compare
dylhunn
left a comment
There was a problem hiding this comment.
reviewed-for: public-api
|
TGP is green. This is ready to merge. |
|
This PR was merged into the repository by commit 81e7f5b. |
) This integration test aims to cover that we do not break the code splitting of the animation module when we use `provideAnimationsAsync()`. PR Close #50738
Let's have the same test app for async and eagerly loaded animations. PR Close #50738
|
was it renamed to |
|
@robertIsaac yes, it was. |
|
I tried it, but saw size increases instead of decrease |
|
@robertIsaac Please file an issue with the repro and we can take a look. |
|
@robertIsaac Please open an new issue with a repro repo and we'll happily investigate that 😊 |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
angular#50738) `provideLazyLoadedAnimations()` returns providers which allow the lazy loading of the animation module. Lazy loading of the animation code can shave off up to 16KB gzipped of the main bundle. PR Close angular#50738
…ular#50738) This integration test aims to cover that we do not break the code splitting of the animation module when we use `provideAnimationsAsync()`. PR Close angular#50738
Let's have the same test app for async and eagerly loaded animations. PR Close angular#50738
If `showHideRelatedCards` is refactored into native CSS, then the package `@angular/animations` could be dropped entirely.
As part of #50399, this work here is a proposition to allow the lazy loading of animations code that can shave off up to 16KB gzipped of the main bundle !
The PR introduces a new entry point in the
platform-browserpackage :lazy-animations. This has been necessary because the eager providers (BROWSER_ANIMATIONS_PROVIDERSandBROWSER_NOOP_ANIMATIONS_PROVIDERS) were retaining symbols from@angular/animation/browsermaking the code splitting & lazy loading impossible.In this entry point, you will find the new
provideLazyLoadingAnimations()function which will provide a newRendererFactory2:AsyncAnimationRendererFactory.AsyncAnimationRendererFactorywill create a newDynamicDelegationRendererwhich will delegate to the default renderer by default.Aside from the renderer, the new factory will lazily import the
@angular/animations/browser. Once the package is loaded, the factory will switch the delegate ofDynamicDelegationRendererto anAnimationRenderer.The side effect of this implementation is that the rendering might not include the styles from the animations defined in components until the module is loaded. This should an acceptable drawback.
Also, I'd like to thank @AndrewKushnir for his help on this PR.
PR Type
Does this PR introduce a breaking change?