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
feat(animations): Provide a way to lazy load the animations #50738
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue was resolved in #51910. Once we have G3 issues resolved, this is good to go.
reviewed-for: fw-animations, fw-core, integration-tests, public-api, size-tracking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for Bazel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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-browser
package :lazy-animations
. This has been necessary because the eager providers (BROWSER_ANIMATIONS_PROVIDERS
andBROWSER_NOOP_ANIMATIONS_PROVIDERS
) were retaining symbols from@angular/animation/browser
making the code splitting & lazy loading impossible.In this entry point, you will find the new
provideLazyLoadingAnimations()
function which will provide a newRendererFactory2
:AsyncAnimationRendererFactory
.AsyncAnimationRendererFactory
will create a newDynamicDelegationRenderer
which 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 ofDynamicDelegationRenderer
to 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?