diff --git a/packages/angular_devkit/build_angular/src/tools/esbuild/bundler-context.ts b/packages/angular_devkit/build_angular/src/tools/esbuild/bundler-context.ts index bc7484c48e74..454778cebae5 100644 --- a/packages/angular_devkit/build_angular/src/tools/esbuild/bundler-context.ts +++ b/packages/angular_devkit/build_angular/src/tools/esbuild/bundler-context.ts @@ -234,10 +234,12 @@ export class BundlerContext { if (this.incremental) { // When incremental always add any files from the load result cache if (this.#loadCache) { - this.#loadCache.watchFiles - .filter((file) => !isInternalAngularFile(file)) - // watch files are fully resolved paths - .forEach((file) => this.watchFiles.add(file)); + for (const file of this.#loadCache.watchFiles) { + if (!isInternalAngularFile(file)) { + // watch files are fully resolved paths + this.watchFiles.add(file); + } + } } } } @@ -247,10 +249,12 @@ export class BundlerContext { // currently enabled with watch mode where watch files are needed. if (this.incremental) { // Add input files except virtual angular files which do not exist on disk - Object.keys(result.metafile.inputs) - .filter((input) => !isInternalAngularFile(input)) - // input file paths are always relative to the workspace root - .forEach((input) => this.watchFiles.add(join(this.workspaceRoot, input))); + for (const input of Object.keys(result.metafile.inputs)) { + if (!isInternalAngularFile(input)) { + // input file paths are always relative to the workspace root + this.watchFiles.add(join(this.workspaceRoot, input)); + } + } } // Return if the build encountered any errors