Skip to content

Commit

Permalink
fix(angular): show actionable error when component resource is not fo…
Browse files Browse the repository at this point in the history
…und in ng-packagr executors (#15217)
  • Loading branch information
leosvelperez committed Feb 24, 2023
1 parent 8a58cdd commit 12fff86
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ export function cacheCompilerHost(

const cache = sourcesFileCache.getOrCreate(fileName);
if (cache.content === undefined) {
if (!compilerHost.fileExists(fileName)) {
throw new Error(`Cannot read file ${fileName}.`);
}

if (/(?:html?|svg)$/.test(path.extname(fileName))) {
// template
cache.content = compilerHost.readFile.call(this, fileName);
Expand All @@ -185,10 +189,6 @@ export function cacheCompilerHost(
});
}

if (cache.content === undefined) {
throw new Error(`Cannot read file ${fileName}.`);
}

cache.exists = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ export function cacheCompilerHost(

const cache = sourcesFileCache.getOrCreate(fileName);
if (cache.content === undefined) {
if (!compilerHost.fileExists(fileName)) {
throw new Error(`Cannot read file ${fileName}.`);
}

if (/(?:html?|svg)$/.test(path.extname(fileName))) {
// template
cache.content = compilerHost.readFile.call(this, fileName);
Expand All @@ -209,10 +213,6 @@ export function cacheCompilerHost(
});
}

if (cache.content === undefined) {
throw new Error(`Cannot read file ${fileName}.`);
}

cache.exists = true;
}

Expand Down

0 comments on commit 12fff86

Please sign in to comment.