Skip to content

Commit ca38ee3

Browse files
clydinalan-agius4
authored andcommitted
fix(@angular-devkit/build-angular): avoid binary content in architect results with browser-esbuild
The builder system (architect) currently attempts to treat all results as JSON and attempts to validate the object with a JSON schema validator. This can lead to slow build completion (even after the actual build is fully complete) or crashes if the size and/or quantity of output files is large. Architect only requires a `success` property so that is all that will be passed here if the infrastructure settings have not been explicitly set to avoid writes. Writing is only disabled when used directly by the dev server which bypasses the architect behavior. (cherry picked from commit cdea518)
1 parent 07e2120 commit ca38ee3

File tree

1 file changed

+10
-1
lines changed
  • packages/angular_devkit/build_angular/src/builders/browser-esbuild

1 file changed

+10
-1
lines changed

packages/angular_devkit/build_angular/src/builders/browser-esbuild/index.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,16 @@ export async function* buildEsbuildBrowser(
5757
await writeResultFiles(result.outputFiles, result.assetFiles, fullOutputPath);
5858
}
5959

60-
yield result;
60+
// The builder system (architect) currently attempts to treat all results as JSON and
61+
// attempts to validate the object with a JSON schema validator. This can lead to slow
62+
// build completion (even after the actual build is fully complete) or crashes if the
63+
// size and/or quantity of output files is large. Architect only requires a `success`
64+
// property so that is all that will be passed here if the infrastructure settings have
65+
// not been explicitly set to avoid writes. Writing is only disabled when used directly
66+
// by the dev server which bypasses the architect behavior.
67+
const builderResult =
68+
infrastructureSettings?.write === false ? result : { success: result.success };
69+
yield builderResult;
6170
}
6271
}
6372

0 commit comments

Comments
 (0)