`externalPackagesPlugin` slows down `ng serve` substantially
@clydin arbeitet bereits daran.
Seit 07.7.2025.
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
Command
serve
Is this a regression?
- Kinda, as the
externalPackagesPluginwas just added via https://github.com/angular/angular-cli/pull/26923
The previous version in which this bug was not present was
Before https://github.com/angular/angular-cli/pull/26923 existed, which was part of 17.1.1, so I guess angular 17.1.0
Description
angular 17.2.0
vite/esbuild powered application builder
Using the loader option in angular.json like:
"loader": { ".webp": "file", ".svg": "text" },
to support images as ecmascript imports or svgs as inline. This causes angular-cli to add the externalPackagesPlugin which is a giant hit on build performance. For our apps:
| angular version | watch rebuild time | note |
|---|---|---|
angular 17.1.0 { "loader": { ".webp": "file" } } |
0.8 seconds |
|
{ "loader": { ".webp": "file" } } |
6.0 seconds |
|
{ "loader": { ".webp": "file" } } |
6.0 seconds |
|
angular 19.2.1 { "loader": { ".webp": "file" } } |
0.8 seconds |
<- file doesn't regress anymore |
angular 19.2.1 { "loader": { ".svg": "text" } } |
6.0 seconds |
<- text still does |
Those additional 5.2 seconds are also added to the initial build.
My rough idea of the issue is, that the externalPackagesPlugin looks at every single import that doesn't start with . or / and doesn't cache the results. So tons of @angular/..., rxjs, @ngrx/... and similar imports are resolved over and over again. Even if this function only needs 2ms to run, this quickly adds up.
Minimal Reproduction
https://github.com/sod/ng-serve-external-deps-slowdown
The only difference between the development and development-slow configurations in the angular.json are:
"development": {
},
"development-slow": {
"loader": {
".svg": "text"
}
},
Your Environment
@angular-devkit/architect 0.1702.0
@angular-devkit/build-angular 17.2.0
@angular-devkit/core 17.2.0
@angular-devkit/schematics 17.2.0
@angular/cli 17.2.0
@schematics/angular 17.2.0
rxjs 7.8.1
typescript 5.3.3
zone.js 0.14.4
- Vorherrschende Sprache
- TypeScript
- Sterne
- 27k
- Forks
- 11.8k
- Ø Merge
- 17 Std. 25 Min.
- Gemergte PRs (30 T.)
- 183
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus angular/angular-cli
-
area: @angular/build gemini-triaged
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
angular/angular-cli#33955 ·
-
area: @angular/cli gemini-triaged
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
angular/angular-cli#33055 · 1 Kommentar · 3 Reaktionen ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34131 · 1 zugewiesene Person ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34130 · 1 zugewiesene Person ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34128 · 1 zugewiesene Person ·
Alle Issues in angular/angular-cli
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
safetrustcr/dApp-SafeTrust#426 ·
-
area:workflow bug ready-for-agent
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
fil-donadoni/tolaria#4409 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
Fission-AI/OpenSpec#1960 ·
-
Add dependabot Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
corsairdev/corsair#1764 ·