just-jeb / angular-builders

Angular build facade extensions (Jest and custom webpack configuration)
MIT License
1.14k stars 198 forks source link

Angular CLI Cache and Serve for esbuild-custom #1778

Closed kukjevov closed 2 months ago

kukjevov commented 3 months ago

Describe the Bug

When using @angular-builders/custom-esbuild:application together with plugin https://github.com/fal-works/esbuild-plugin-global-externals it is working when you use build and run http server to serve files, but when you run ng serve with @angular-builders/custom-esbuild:dev-server and your angular.json cli.cache.enabled is set to true that plugin is ignored and application is not working.

Is this problem of how Angular CLI works, or is there something missing in @angular-builders/custom-esbuild:dev-server ?

Minimal Reproduction

git checkout https://github.com/kukjevov/ng-universal-demo cd ng-universal-demo git checkout cache/2.0 npm install npm start open http://localhost:8888 log in as admin admin

and there you have error.

If you turn off angular CLI cache it will work correctly.

Expected Behavior

It should also work with cache enabled.

Environment


Libs
- @angular/core version: 17.3.6
- @angular-devkit/build-angular version: 17.3.6
- @angular-builders/custom-esbuild version: 17.1.2

For Tooling issues:
- Node version: 20.13.0
- Platform:   Windows

## Additional Context

Problem is that plugin is only applied when cache is disabled.            
just-jeb commented 3 months ago

From a quick glance I can't see anything in the builder's flow that can impact the cache. I think the sheer fact that you're using this plugin and the way it incorporates itself in the Angular CLI build flow is the issue. I'd open an issue in Angular CLI repo. Bear in mind though that custom plugins are not officially supported by Angular CLI (only via 3rd party builders like this one) but there is only so much we can do. It might as well indicate at a broader issue within their flow.

kukjevov commented 2 months ago

https://github.com/angular/angular-cli/issues/27956 this is Answer of Angular CLI team, i have to try it

kukjevov commented 2 months ago

Closing as "solved" hopefuly