Performance: Migrating from NgModules
MEDIUM IMPACT
This affects the initial page load speed and runtime rendering performance by changing how Angular loads and compiles components.
import { bootstrapApplication } from '@angular/platform-browser'; import { AppComponent } from './app.component'; bootstrapApplication(AppComponent);
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { AppComponent } from './app.component'; @NgModule({ declarations: [AppComponent], imports: [BrowserModule], bootstrap: [AppComponent] }) export class AppModule {}
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| NgModules | No direct change | No direct change | Blocks initial paint until module compiles | [X] Bad |
| Standalone Components | No direct change | No direct change | Faster initial paint by skipping module compilation | [OK] Good |