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
|
@ -267,6 +267,10 @@ export function compile({allowNonHermeticReads, allDepsCompiledWithBazel = true,
|
||||||
fs.writeFileSync(bazelOpts.manifest, manifest);
|
fs.writeFileSync(bazelOpts.manifest, manifest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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 (!bazelOpts.nodeModulesPrefix) {
|
||||||
// If there is no node modules, then metadata.json should be emitted since
|
// If there is no node modules, then metadata.json should be emitted since
|
||||||
|
|
Loading…
Reference in New Issue