Skip to content

Commit 4363ca4

Browse files
author
Andy Hanson
committed
Canonicalize path before calling startsWith
1 parent 950593b commit 4363ca4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/compiler/moduleSpecifiers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ namespace ts.moduleSpecifiers {
290290
const moduleSpecifier = getDirectoryOrExtensionlessFileName(moduleFileName);
291291
// Get a path that's relative to node_modules or the importing file's path
292292
// if node_modules folder is in this folder or any of its parent folders, no need to keep it.
293-
if (!startsWith(sourceDirectory, moduleSpecifier.substring(0, parts.topLevelNodeModulesIndex))) return undefined;
293+
if (!startsWith(sourceDirectory, getCanonicalFileName(moduleSpecifier.substring(0, parts.topLevelNodeModulesIndex)))) return undefined;
294294
// If the module was found in @types, get the actual Node package name
295295
return getPackageNameFromAtTypesDirectory(moduleSpecifier.substring(parts.topLevelPackageNameIndex + 1));
296296

0 commit comments

Comments
 (0)