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
This commit is contained in:
parent
dab5df9734
commit
e1c4930a1a
|
@ -268,6 +268,10 @@ export function compile({allowNonHermeticReads, allDepsCompiledWithBazel = true,
|
|||
}
|
||||
}
|
||||
|
||||
// If compilation fails unexpectedly, performCompilation returns no program.
|
||||
// Make sure not to crash but report the diagnostics.
|
||||
if (!program) return {program, diagnostics};
|
||||
|
||||
if (!bazelOpts.nodeModulesPrefix) {
|
||||
// If there is no node modules, then metadata.json should be emitted since
|
||||
// there is no other way to obtain the information
|
||||
|
|
Loading…
Reference in New Issue