Don’t offer non-relative non-paths path when baseUrl is undefined (#40813)

This commit is contained in:
Andrew Branch authored and GitHub committed 2020-09-28 12:06:39 -07:00
1 parent 343a0a04d7
commit 3e824f18a8
3 files changed
+26 -2

No files matched your search

+4 -1
View File
@@ -174,7 +174,10 @@ namespace ts.moduleSpecifiers {
const bundledPkgReference = bundledPackageName ? combinePaths(bundledPackageName, relativeToBaseUrl) : relativeToBaseUrl;
const importRelativeToBaseUrl = removeExtensionAndIndexPostFix(bundledPkgReference, ending, compilerOptions);
const fromPaths = paths && tryGetModuleNameFromPaths(removeFileExtension(bundledPkgReference), importRelativeToBaseUrl, paths);
const nonRelative = fromPaths === undefined ? importRelativeToBaseUrl : fromPaths;
const nonRelative = fromPaths === undefined && baseUrl !== undefined ? importRelativeToBaseUrl : fromPaths;
if (!nonRelative) {
return relativePath;
}
if (relativePreference === RelativePreference.NonRelative) {
return nonRelative;