Skip to content

Commit 5c8c2eb

Browse files
committed
refactor(animations): make async animations code compatible with Closure compiler (angular#55686)
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. PR Close angular#55686
1 parent b74a17e commit 5c8c2eb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/platform-browser/animations/async/src/async_animation_renderer.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ export class AsyncAnimationRendererFactory implements OnDestroy, RendererFactory
6565
* @internal
6666
*/
6767
private loadImpl(): Promise<AnimationRendererFactory> {
68-
const moduleImpl = this.moduleImpl ?? import('@angular/animations/browser');
68+
// Note on the `.then(m => m)` part below: Closure compiler optimizations in g3 require
69+
// `.then` to be present for a dynamic import (or an import should be `await`ed) to detect
70+
// the set of imported symbols.
71+
const moduleImpl = this.moduleImpl ?? import('@angular/animations/browser').then((m) => m);
6972

7073
return moduleImpl
7174
.catch((e) => {

0 commit comments

Comments
 (0)