fix(compiler): always use relative paths to refer to generated code

Previously we generated imports like `@angular/material/index.ngfactory`,
which doesn’t make sense as we don’t ship generated code on npm

Closes #20031
This commit is contained in:
Tobias Bosch
2017-10-30 11:54:40 -07:00
committed by Matias Niemelä
parent 308fc8e328
commit 04eb80cc2b
2 changed files with 10 additions and 1 deletions

View File

@ -192,7 +192,8 @@ export class TsCompilerAotCompilerTypeCheckHostAdapter implements ts.CompilerHos
const containingFilePackageName = getPackageName(containingFile);
let moduleName: string;
if (importedFilePackagName === containingFilePackageName) {
if (importedFilePackagName === containingFilePackageName ||
GENERATED_FILES.test(originalImportedFile)) {
const rootedContainingFile = relativeToRootDirs(containingFile, this.rootDirs);
const rootedImportedFile = relativeToRootDirs(importedFile, this.rootDirs);