Treat "." and ".." as relative module names

This commit is contained in:
Andy Hanson
2016-07-12 14:54:06 -07:00
parent f9d29370b6
commit c90897ccdd
7 changed files with 102 additions and 11 deletions

View File

@@ -112,13 +112,7 @@ namespace ts {
}
function moduleHasNonRelativeName(moduleName: string): boolean {
if (isRootedDiskPath(moduleName)) {
return false;
}
const i = moduleName.lastIndexOf("./", 1);
const startsWithDotSlashOrDotDotSlash = i === 0 || (i === 1 && moduleName.charCodeAt(0) === CharacterCodes.dot);
return !startsWithDotSlashOrDotDotSlash;
return !(isRootedDiskPath(moduleName) || isExternalModuleNameRelative(moduleName));
}
interface ModuleResolutionState {