From 6066eaec092240b17b964ca1b4762edd07202671 Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Thu, 25 Mar 2021 17:12:13 -0700 Subject: [PATCH] Port realpath workaround from release-4.2 (#43384) * Don't use _fs.realpathSync.native on windows, a semi-revert of #41292 (#43348) We're planning a real fix for TS 4.3, but port the workaround from 4.2 so the beta doesn't have this bug. (cherry picked from commit e462dfa34786859b6380ac73d77113c031dc2ef5) * Un-reverse condition Co-authored-by: Orta Therox --- src/compiler/sys.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 5d2c256383d..37ea6450f7c 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -1265,7 +1265,6 @@ namespace ts { let activeSession: import("inspector").Session | "stopping" | undefined; let profilePath = "./profile.cpuprofile"; - const realpathSync = _fs.realpathSync.native ?? _fs.realpathSync; const Buffer: { new (input: string, encoding?: string): any; @@ -1278,6 +1277,8 @@ namespace ts { const platform: string = _os.platform(); const useCaseSensitiveFileNames = isFileSystemCaseSensitive(); + const realpathSync = useCaseSensitiveFileNames ? (_fs.realpathSync.native ?? _fs.realpathSync) : _fs.realpathSync; + const fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin"); const getCurrentDirectory = memoize(() => process.cwd()); const { watchFile, watchDirectory } = createSystemWatchFunctions({