Skip to content

Commit

Permalink
refactor(animations): make async animations code compatible with Clos…
Browse files Browse the repository at this point in the history
…ure compiler

Closure compiler optimizations in g3 require `.then` to be present for a dynamic import (or an import should be `await`ed) to detect the set of imported symbols. Currently, the `.then` is located at a later stage in the file, which confuses static code analysis. This change adds the `.then((m) => m)` workaround to satisfy Closure compiler constraints.
  • Loading branch information
AndrewKushnir committed May 6, 2024
1 parent 1872fcd commit 77cd3b4
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ export class AsyncAnimationRendererFactory implements OnDestroy, RendererFactory
* @internal
*/
private loadImpl(): Promise<AnimationRendererFactory> {
const moduleImpl = this.moduleImpl ?? import('@angular/animations/browser');
// Note on the `.then(m => m)` part below: Closure compiler optimizations in g3 require
// `.then` to be present for a dynamic import (or an import should be `await`ed) to detect
// the set of imported symbols.
const moduleImpl = this.moduleImpl ?? import('@angular/animations/browser').then((m) => m);

return moduleImpl
.catch((e) => {
Expand Down

0 comments on commit 77cd3b4

Please sign in to comment.