Skip to content

Commit a3ea961

Browse files
committed
Do not canonicalize the file names when getting absolute paths
Fixes #50544
1 parent 0cb4514 commit a3ea961

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

src/compiler/moduleNameResolver.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2227,7 +2227,7 @@ namespace ts {
22272227
function toAbsolutePath(path: string | undefined): string | undefined;
22282228
function toAbsolutePath(path: string | undefined): string | undefined {
22292229
if (path === undefined) return path;
2230-
return hostGetCanonicalFileName({ useCaseSensitiveFileNames })(getNormalizedAbsolutePath(path, state.host.getCurrentDirectory?.()));
2230+
return getNormalizedAbsolutePath(path, state.host.getCurrentDirectory?.());
22312231
}
22322232

22332233
function combineDirectoryPath(root: string, dir: string) {

tests/baselines/reference/tscWatch/forceConsistentCasingInFileNames/with-nodeNext-resolution.js

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ File '/Users/name/projects/web/node_modules/yargs.tsx' does not exist.
5454
File '/Users/name/projects/web/node_modules/yargs.d.ts' does not exist.
5555
Found 'package.json' at '/Users/name/projects/web/node_modules/@types/yargs/package.json'.
5656
'package.json' does not have a 'typesVersions' field.
57-
File '/users/name/projects/web/node_modules/@types/yargs/index.d.ts' exist - use it as a name resolution result.
58-
Resolving real path for '/users/name/projects/web/node_modules/@types/yargs/index.d.ts', result '/Users/name/projects/web/node_modules/@types/yargs/index.d.ts'.
59-
======== Module name 'yargs' was successfully resolved to '/users/name/projects/web/node_modules/@types/yargs/index.d.ts' with Package ID 'yargs/[email protected]'. ========
57+
File '/Users/name/projects/web/node_modules/@types/yargs/index.d.ts' exist - use it as a name resolution result.
58+
Resolving real path for '/Users/name/projects/web/node_modules/@types/yargs/index.d.ts', result '/Users/name/projects/web/node_modules/@types/yargs/index.d.ts'.
59+
======== Module name 'yargs' was successfully resolved to '/Users/name/projects/web/node_modules/@types/yargs/index.d.ts' with Package ID 'yargs/[email protected]'. ========
6060
File '/users/name/projects/web/node_modules/@types/yargs/package.json' exists according to earlier cached lookups.
6161
======== Resolving type reference directive 'yargs', containing file '/Users/name/projects/web/__inferred type names__.ts', root directory '/Users/name/projects/web/node_modules/@types'. ========
6262
Resolving with primary search path '/Users/name/projects/web/node_modules/@types'.
@@ -69,15 +69,6 @@ Resolving real path for '/Users/name/projects/web/node_modules/@types/yargs/inde
6969
File '/a/lib/package.json' does not exist.
7070
File '/a/package.json' does not exist.
7171
File '/package.json' does not exist according to earlier cached lookups.
72-
src/bin.ts:1:21 - error TS1261: Already included file name '/users/name/projects/web/node_modules/@types/yargs/index.d.ts' differs from file name '/Users/name/projects/web/node_modules/@types/yargs/index.d.ts' only in casing.
73-
The file is in the program because:
74-
Imported via "yargs" from file '/Users/name/projects/web/src/bin.ts' with packageId 'yargs/[email protected]'
75-
Entry point for implicit type library 'yargs' with packageId 'yargs/[email protected]'
76-
File is CommonJS module because '/users/name/projects/web/node_modules/@types/yargs/package.json' does not have field "type"
77-
78-
1 import { foo } from "yargs";
79-
   ~~~~~~~
80-
8172
../../../../a/lib/lib.d.ts
8273
Default library for target 'es3'
8374
node_modules/@types/yargs/index.d.ts
@@ -87,7 +78,7 @@ node_modules/@types/yargs/index.d.ts
8778
src/bin.ts
8879
Matched by default include pattern '**/*'
8980
File is CommonJS module because 'package.json' was not found
90-
[[90m12:00:38 AM[0m] Found 1 error. Watching for file changes.
81+
[[90m12:00:38 AM[0m] Found 0 errors. Watching for file changes.
9182

9283

9384

@@ -96,12 +87,12 @@ Program options: {"moduleResolution":99,"forceConsistentCasingInFileNames":true,
9687
Program structureReused: Not
9788
Program files::
9889
/a/lib/lib.d.ts
99-
/users/name/projects/web/node_modules/@types/yargs/index.d.ts
90+
/Users/name/projects/web/node_modules/@types/yargs/index.d.ts
10091
/Users/name/projects/web/src/bin.ts
10192

10293
Semantic diagnostics in builder refreshed for::
10394
/a/lib/lib.d.ts
104-
/users/name/projects/web/node_modules/@types/yargs/index.d.ts
95+
/Users/name/projects/web/node_modules/@types/yargs/index.d.ts
10596
/Users/name/projects/web/src/bin.ts
10697

10798
Shape signatures in builder refreshed for::
@@ -115,7 +106,7 @@ WatchedFiles::
115106
/users/name/projects/web/src/bin.ts:
116107
{"fileName":"/Users/name/projects/web/src/bin.ts","pollingInterval":250}
117108
/users/name/projects/web/node_modules/@types/yargs/index.d.ts:
118-
{"fileName":"/users/name/projects/web/node_modules/@types/yargs/index.d.ts","pollingInterval":250}
109+
{"fileName":"/Users/name/projects/web/node_modules/@types/yargs/index.d.ts","pollingInterval":250}
119110
/a/lib/lib.d.ts:
120111
{"fileName":"/a/lib/lib.d.ts","pollingInterval":250}
121112
/users/name/projects/web/node_modules/@types/yargs/package.json:

0 commit comments

Comments
 (0)