Compare commits

...

1 Commits

Author SHA1 Message Date
Martin Probst
ab41920e30
fix(compiler): avoid a crash in ngc-wrapped.
`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.
2018-04-20 14:53:32 +02:00

View File

@ -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