fix(ngc): prepend a rootDir when assuming a file exists (#11291)

Otherwise we'll later try to resolve the file under one of the rootDirs and won't find it.
This commit is contained in:
Alex Eagle 2016-09-02 14:52:14 -07:00 committed by Martin Probst
parent f5101782d9
commit c31535982c
1 changed files with 5 additions and 1 deletions

View File

@ -74,7 +74,11 @@ export class PathMappedReflectorHost extends ReflectorHost {
// If a file does not yet exist (because we compile it later), we still need to // If a file does not yet exist (because we compile it later), we still need to
// assume it exists so that the `resolve` method works! // assume it exists so that the `resolve` method works!
if (!this.context.fileExists(importedFile)) { if (!this.context.fileExists(importedFile)) {
this.context.assumeFileExists(importedFile); if (this.options.rootDirs && this.options.rootDirs.length > 0) {
this.context.assumeFileExists(path.join(this.options.rootDirs[0], importedFile));
} else {
this.context.assumeFileExists(importedFile);
}
} }
const resolvable = (candidate: string) => { const resolvable = (candidate: string) => {