angular / angular-cli

CLI tool for Angular
https://cli.angular.dev
MIT License
26.78k stars 11.98k forks source link

Unnecessary rebuild when using an external plugin #28890

Closed HazzMan2409 closed 3 days ago

HazzMan2409 commented 3 days ago

Command

build, serve

Is this a regression?

The previous version in which this bug was not present was

No response

Description

When you add an esbuild plugin to use a global that was loaded in via angular.json scripts instead of having it bundled, you get an extra rebuild when you run a build in watch mode on startup.

I've got a minimal setup in the linked repo with Leaflet. If you run ng serve --verbose you will see what I mean.

I've checked and running the exact same plugin with esbuild directly does not cause this extra rebuild. Note that I'm using https://www.npmjs.com/package/@angular-builders/custom-esbuild to run the esbuild plugin.

Minimal Reproduction

https://github.com/HazzMan2409/ng-extra-rebuild

Exception or Error

Your Environment

Angular CLI: 18.2.12
Node: 20.11.0
Package Manager: npm 10.2.4
OS: darwin arm64

Angular: 18.2.12
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1802.12
@angular-devkit/build-angular   18.2.12
@angular-devkit/core            18.2.12
@angular-devkit/schematics      18.2.12
@schematics/angular             18.2.12
rxjs                            7.8.1
typescript                      5.5.4
zone.js                         0.14.10

Anything else relevant?

No response

dgp1130 commented 3 days ago

Angular does not support custom esbuild, so we can't provide any real guidance on what might be going on here.

HazzMan2409 commented 3 days ago

Ok. I'll try and re-create the issue with a minimal reproduction using angular's builder api to add an esbuild plugin.

If it's a bug with custom esbuild I'll raise an issue there.