-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Description
🚀 Feature request
Command (mark with an x)
- new
- build
- serve
- test
- e2e
- generate
- add
- update
- lint
- extract-i18n
- run
- config
- help
- version
- doc
Description
Regarding the new experimental @angular-devkit/build-angular:browser-esbuild builder, it would be great if you could expose a way to set esbuild options via configuration, specifically the external option is what I'm looking for at the moment to ensure externalized code (consumed/shared at runtime via ESM from a CDN) is not included in the Angular bundle (we want to use bare module specifiers and import maps).
For context, we are using @angular/elements combined with the new esbuild builder to share a custom element across applications, and consume shared ESM dependencies in both the application and custom element. We use typings from an npm package locally for the bare module specifier, but importmap at runtime to route it to the CDN.
I know this builder is experimental still, but I figured you would be interested in understanding how we're attempting to use it.
Describe the solution you'd like
I would expect to provide these options via angular.json. Something along the lines of an esbuildOptions property that will get passed directly down to esbuild.
Describe alternatives you've considered
I've modified the node_modules/@angular-devkit/build-angular/src/builders/browser-esbuild/esbuild.js file locally for testing purposes to get by for now which works, but otherwise I'll need to fork this repo to produce my own build that supports this until it's implemented in the main package. If this isn't something on your radar any time soon please let me know and I could create a PR when it comes time for us needing to put more priority on this.
Also, if you know of an alternative workaround to pass the config for the short term please let me know!