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:
parent
360be02c0e
commit
81acbad058
|
@ -49,9 +49,19 @@ export class Transformer {
|
||||||
|
|
||||||
transform(entryPoint: EntryPoint, format: EntryPointFormat): void {
|
transform(entryPoint: EntryPoint, format: EntryPointFormat): void {
|
||||||
if (checkMarkerFile(entryPoint, format)) {
|
if (checkMarkerFile(entryPoint, format)) {
|
||||||
|
console.warn(`Skipping ${entryPoint.name} : ${format} (already built).`);
|
||||||
return;
|
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 = {
|
const options: ts.CompilerOptions = {
|
||||||
allowJs: true,
|
allowJs: true,
|
||||||
maxNodeModuleJsDepth: Infinity,
|
maxNodeModuleJsDepth: Infinity,
|
||||||
|
@ -62,11 +72,6 @@ export class Transformer {
|
||||||
// TODO : create a custom compiler host that reads from .bak files if available.
|
// TODO : create a custom compiler host that reads from .bak files if available.
|
||||||
const host = ts.createCompilerHost(options);
|
const host = ts.createCompilerHost(options);
|
||||||
const rootDirs = this.getRootDirs(host, 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 isCore = entryPoint.name === '@angular/core';
|
||||||
const r3SymbolsPath = isCore ? this.findR3SymbolsPath(dirname(entryPointFilePath)) : null;
|
const r3SymbolsPath = isCore ? this.findR3SymbolsPath(dirname(entryPointFilePath)) : null;
|
||||||
const rootPaths = r3SymbolsPath ? [entryPointFilePath, r3SymbolsPath] : [entryPointFilePath];
|
const rootPaths = r3SymbolsPath ? [entryPointFilePath, r3SymbolsPath] : [entryPointFilePath];
|
||||||
|
|
Loading…
Reference in New Issue