fix(ivy): ngcc - skip missing formats rather than erroring (#26403)

It is perfectly normal for some of the formats to be missing from
a package. We should not fail compilation for this.

PR Close #26403
This commit is contained in:
Pete Bacon Darwin 2018-10-15 16:54:42 +01:00 committed by Kara Erickson
parent 360be02c0e
commit 81acbad058
1 changed files with 10 additions and 5 deletions

View File

@ -49,9 +49,19 @@ export class Transformer {
transform(entryPoint: EntryPoint, format: EntryPointFormat): void {
if (checkMarkerFile(entryPoint, format)) {
console.warn(`Skipping ${entryPoint.name} : ${format} (already built).`);
return;
}
const entryPointFilePath = entryPoint[format];
if (!entryPointFilePath) {
console.warn(
`Skipping ${entryPoint.name} : ${format} (no entry point file for this format).`);
return;
}
console.warn(`Compiling ${entryPoint.name} - ${format}`);
const options: ts.CompilerOptions = {
allowJs: true,
maxNodeModuleJsDepth: Infinity,
@ -62,11 +72,6 @@ export class Transformer {
// TODO : create a custom compiler host that reads from .bak files if available.
const host = ts.createCompilerHost(options);
const rootDirs = this.getRootDirs(host, options);
const entryPointFilePath = entryPoint[format];
if (!entryPointFilePath) {
throw new Error(
`Missing entry point file for format, ${format}, in package, ${entryPoint.path}.`);
}
const isCore = entryPoint.name === '@angular/core';
const r3SymbolsPath = isCore ? this.findR3SymbolsPath(dirname(entryPointFilePath)) : null;
const rootPaths = r3SymbolsPath ? [entryPointFilePath, r3SymbolsPath] : [entryPointFilePath];