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:
parent
f5101782d9
commit
c31535982c
|
@ -74,8 +74,12 @@ 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)) {
|
||||||
|
if (this.options.rootDirs && this.options.rootDirs.length > 0) {
|
||||||
|
this.context.assumeFileExists(path.join(this.options.rootDirs[0], importedFile));
|
||||||
|
} else {
|
||||||
this.context.assumeFileExists(importedFile);
|
this.context.assumeFileExists(importedFile);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const resolvable = (candidate: string) => {
|
const resolvable = (candidate: string) => {
|
||||||
const resolved = this.getCanonicalFileName(this.resolve(candidate, importedFile));
|
const resolved = this.getCanonicalFileName(this.resolve(candidate, importedFile));
|
||||||
|
|
Loading…
Reference in New Issue