angular: AOT builds with TypeScript 5.6 or later are slower in Angular 19
Command
serve
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
18.0.1
Description
After upgrading my project from Angular 18 to Angular 19 using ng update, I’ve noticed a significant performance degradation with ng serve. Previously, rebuilds were much faster, but now they take up to 10 seconds or more.
Minimal Reproduction
https://github.com/Oussemasahbeni/saha-meter-frontend
I made the repo public until the issue got resolved, its a close source project for my company Please check the clean-up branch
Exception or Error
Your Environment
Angular CLI: 19.0.2
Node: 22.11.0
Package Manager: npm 10.9.0
OS: win32 x64
Angular: 19.0.1
... animations, cdk, common, compiler, compiler-cli, core, forms
... material, material-luxon-adapter, platform-browser
... platform-browser-dynamic, router, service-worker
... youtube-player
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1900.2
@angular-devkit/build-angular 19.0.2
@angular-devkit/core 19.0.2
@angular-devkit/schematics 19.0.2
@angular/build 19.0.2
@angular/cli 19.0.2
@schematics/angular 19.0.2
rxjs 7.8.1
typescript 5.6.3
zone.js 0.15.0
Anything else relevant?
I managed to make it a little bit faster by disabling aot in development
"development": {
"optimization": false,
"extractLicenses": false,
"aot":false,
"sourceMap": true
}
but still a lot of people told that is not a solution but a workaround and it can hurt the project in the long term
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 15
- Comments: 18 (7 by maintainers)
After a brief review, it seems the regression is linked to the upgrade in the TypeScript version.
TypeScript 5.5.3
TypeScript 5.6.3
I was looking into https://github.com/ng-packagr/ng-packagr/issues/2969 and noticed that, starting with TypeScript 5.6, the
getDeclarationDiagnosticsmethod was replaced withgetDeclarationDiagnostics2. This change significantly increased the execution time.TS 5.5
TS 5.6 and TS5.7
Edit: I’ve opened an issue with TypeScript to track this https://github.com/microsoft/TypeScript/issues/60970. Note: This change does not affect application builds.
+1
Just few thoughts:
If perf dropped in hello world app from 0.75s to 4s. For our real project with 8k files that drop from 60s to 90-100s for mac m1 (cold start) and dropped also for rebuilds. Intel chipset users just prepare coffee until serve cold build finished.
After 19.0.5 it’s slightly better, 75-80s instead of 60s from 18.2
Some possible suggestions:
CodSpeed(free for public open source).Because for my long journey with angular since 2 beta I got few perf degradations from release to release (and maybe not all problems is in Angular itself, but in third-party tooling)
This fix has landed in the CLI 19.0.5 via angular/angular-cli#29057.
Hey, I recently investigated slow build times for our enterprise app. Initially, I thought the issue might be related to the builder or the TypeScript version. However, I discovered that the real bottleneck was Sass compilation, specifically the material imports in my sass files. While the esbuild-based builder itself is extremely fast, the use of plugins (for example built-in angular-sass) significantly impacts performance. You can see my comment with more details here: https://github.com/angular/components/issues/28971#issuecomment-2669583078
In my case, the production build time went down from 10 minutes to 4 minutes after addressing this issue.
Additionally, you can enable esbuild’s debug mode by adding the
--log-level=debugflag. Since there isn’t a direct way to pass this flag via the Angular CLI, I used thepatch-packagetool to manually modify the esbuild npm package. Maybe some other process is slowing down your build.By the way, recommending
aot=falseis not good advice, especially for production environments.While testing the project I work on, I noticed that the issue isn’t related to TypeScript. I didn’t have time to pinpoint which package specifically caused the slowdown, but Angular 19.0.3 and earlier versions don’t exhibit this problem in my project. However, after updating some Angular packages, or even just Nx to a newer version, the build time increased drastically from around 140 seconds to 500 seconds, even when using TypeScript 5.5.4
Edit: With the “fix” it takes 290s.
These are the versions I don’t get slowdown:

The problem is that building is broken on these versions, it fixes when updating but than I get the slow serve compilation.