Skip to content

Commit

Permalink
fix(compiler-cli): Temp fix in program.ts issue (#22524)
Browse files Browse the repository at this point in the history
Compiling a project with duplicated sub dependencies causes 'Host should not return a redirect source file from `getSourceFile`' error to be shown. This is fixed by not returning the redirected file, but rather the target of the redirect.

Closes #22524
  • Loading branch information
JonWallsten committed Sep 20, 2018
1 parent ef654f7 commit 42f8e6e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/compiler-cli/src/transformers/program.ts
Expand Up @@ -693,6 +693,10 @@ class AngularCompilerProgram implements Program {
const tsFiles: string[] = [];
tmpProgram.getSourceFiles().forEach(sf => {
if (this.hostAdapter.isSourceFile(sf.fileName)) {
// Temporary fix for https://github.com/angular/angular/issues/22524
// Typescript has internal notion of "redirect source files"
// Do not return the redirected file, but rather the target of the redirect.
// redirectInfo is an internal property on the SourceFile interface, hence the (as any)
if ((sf as any)['redirectInfo']) {
sf = (sf as any)['redirectInfo'].redirectTarget;
}
Expand Down

0 comments on commit 42f8e6e

Please sign in to comment.