Skip to content

Commit 0bc8443

Browse files
mprobstvicb
authored andcommitted
fix(compiler): avoid a crash in ngc-wrapped. (#23468)
`ng.performCompilation` can return an `undefined` program, which is not handled by ngc-wrapped. Avoid crashing by checking for the error return and returning the diagnostics. PR Close #23468
1 parent db17231 commit 0bc8443

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/bazel/src/ngc-wrapped/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,10 @@ export function compile({allowNonHermeticReads, allDepsCompiledWithBazel = true,
267267
fs.writeFileSync(bazelOpts.manifest, manifest);
268268
}
269269
}
270+
271+
// If compilation fails unexpectedly, performCompilation returns no program.
272+
// Make sure not to crash but report the diagnostics.
273+
if (!program) return {program, diagnostics};
270274

271275
if (!bazelOpts.nodeModulesPrefix) {
272276
// If there is no node modules, then metadata.json should be emitted since

0 commit comments

Comments
 (0)