`externalPackagesPlugin` slows down `ng serve` substantially
@clydin ya está trabajando en esto.
Desde el 7/7/2025.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
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
- Lenguaje dominante
- TypeScript
- Estrellas
- 27k
- Forks
- 11.8k
- Merge medio
- 16 h 35 min
- PR fusionados (30 d)
- 176
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de angular/angular-cli
-
Can't use an array of hostnames in --allowedHosts cli parameter in @angular/build:dev-server Abiertoarea: @angular/build gemini-triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
angular/angular-cli#33955 ·
-
area: @angular/cli gemini-triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
angular/angular-cli#33055 · 1 comentario · 3 reacciones ·
-
unit-test: with --coverage, a setup file's hooks reach only the first spec file of each worker Abiertoarea: @angular/build gemini-triaged
Dificultad 4/5 3-5 días Aptitud para principiantes 72/100
angular/angular-cli#34137 ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34131 · 1 asignado ·
-
angular/build:library area: @angular/build gemini-triaged
angular/angular-cli#34130 · 1 asignado ·
Todos los issues de angular/angular-cli
Issues similares
-
[Bug]: Discord Activity titles with emoji are rejected as over 80 characters when they are not Abiertoclawsweeper:linked-pr-open clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:message-loss issue-rating: 🦞 diamond lobster maturity:stable P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Eynzof/Hermes-CN-Desktop#616 ·
-
ZCode 3.14.3 に対応する Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
supermomonga/zcode-acp#24 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
growthbook/growthbook#7100 ·
-
triage
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100