Open shisukei opened 6 months ago
');
const config = <p>Configuration: ${targetOptions.configuration}</p>
;
return ${indexHtml.slice(0, i)} ${config} ${indexHtml.slice(i)}
;
};
- Adding indexHtmlTransformer in angular.json
Here is the result on ng build / ng serve :
![custom esbuild ko](https://github.com/just-jeb/angular-builders/assets/161057748/02ffb62b-971f-4e49-8d9e-f35e2971d045)
## Expected Behavior
TargetOptions should be there. Or at least, documentation needs an update.
## Environment
<pre><code>
Libs
- @angular/core version: 17.2.0
- @angular-devkit/build-angular version: 17.2.1
- @angular-builders/custom-esbuild: 17.1.0
For Tooling issues:
- Node version: 20.11.1
- Platform: Windows
I just got the same error and the arguments seem to have change.
The 1st argument should be indexHtml: string
, but get nothing from the 2nd argument (targetOptions
).
Seems packages/custom-esbuild/src/application/index.ts::30 should be something like
return { codePlugins, indexHtmlTransformer: indexHtmlTransformer?.bind(null, options) } as ApplicationBuilderExtensions;
But options param seems only contain target options, not configuration
Describe the Bug
Hi,
I am currently working on upgrading an Angular 16 application to Angular 17 and I would like to use esbuild. My application requires index.html transformation. This transformation relies on data from the targetOptions parameter.
With version 16, I was using
@angular-builders/custom-webpack
and it was working fine. Unfortunately, with@angular-builders/custom-esbuild
, the targetOptions are not present during the transformation. Instead, it's the content of the index file. Yet the documentation indicates that targetOptions should be accessible.Minimal Reproduction
Just creating a new Angular 17 application (via ng new), and following the instruction of the doc :
@angular-builders/custom-esbuild
as a dev dependency@angular-devkit/build-angular:application
with@angular-builders/custom-esbuild:application
and@angular-devkit/build-angular:dev-server
with@angular-builders/custom-esbuild:dev-server
in angular.jsontype TargetOptions = json.JsonObject & Target;
export default (targetOptions: TargetOptions, indexHtml: string) => { console.log('targetOptions', targetOptions);
const i = indexHtml.indexOf('