Question
BrowserAnimationsModule vs NoopAnimationsModule: Angular Material animation retention in production builds
Zo Nea
0 reputation · 29 Jan 2021, 17:02 UTC
54.2K views0
Goal
Retain MatMenu and MatTooltip animations after an Angular CLI production build while keeping the standard BrowserAnimationsModule import.
Constraints & Uncertainty
- Production optimization in
angular.jsoncan strip animation triggers, making components appear non‑interactive. - Replacing
BrowserAnimationsModulewithNoopAnimationsModuleavoids runtime errors but disables all Material animations globally, requiring per‑component opt‑ins. - Behavior changed in Angular 15+; earlier versions may not exhibit the same stripping, and custom webpack or Vite setups can alter outcomes.
Open Questions
- Which
angular.jsonoptimization flags (e.g.,scriptsOptimization,stylesOptimization) preserve animation metadata for Material components? - Is there a supported pattern to selectively enable animations per component when
NoopAnimationsModuleis the root provider? - Does Angular 15+ require additional compiler options or polyfills to keep animations intact in production builds?