-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Description
Command
build
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
Switching from a Webpack based builder to an Esbuild based builder breaks .js
fileReplacements. Esbuild based builders ignore the fileReplacements (without Error) when the allowJs flag in tsconfig compilerOptions is false or not set.
Minimal Reproduction
- Add a fileReplacement in angular.json which replaces a file with a
.js
file. - Build the project with a Webpack based builder.
- See that the file was replaced properly.
- Build the project with an Esbuild based builder.
- See that the file was not replaced.
- Issue can be resolved by setting
compilerOptions.allowJs
totrue
in tsconfig.
Issue occurs with ng build
and ng serve
.
When you build both projects you will see that the webpack builder output chunk contains {foo: "bar"}
while the esbuild builder output chunks exports an empty object.
Issue can also be observed when serving both applications and comparing the log in the console.
Exception or Error
No response
Your Environment
Angular CLI: 18.2.9
Node: 20.11.1
Package Manager: npm 10.2.4
OS: darwin arm64
Angular: 18.2.8
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
@angular-devkit/architect 0.1802.9
@angular-devkit/build-angular 18.2.9
@angular-devkit/core 18.2.9
@angular-devkit/schematics 18.2.9
@angular/cli 18.2.9
@schematics/angular 18.2.9
rxjs 7.8.1
typescript 5.5.4
zone.js 0.14.10
Anything else relevant?
No response