From 9f190077e257e494f8e758f8e3c440a6386d3e23 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 5 Oct 2021 22:06:45 +0000 Subject: [PATCH] Cherry-pick PR #46209 into release-4.4 Component commits: 228679871a Limit package.json realpath lookup to only successful resolutions --- src/compiler/tsbuildPublic.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/tsbuildPublic.ts b/src/compiler/tsbuildPublic.ts index 5284be22787b2..2d02637c7ec49 100644 --- a/src/compiler/tsbuildPublic.ts +++ b/src/compiler/tsbuildPublic.ts @@ -873,7 +873,7 @@ namespace ts { ); state.lastCachedPackageJsonLookups.set(projectPath, state.moduleResolutionCache && map( state.moduleResolutionCache.getPackageJsonInfoCache().entries(), - ([path, data]) => ([state.host.realpath ? toPath(state, state.host.realpath(path)) : path, data] as const) + ([path, data]) => ([state.host.realpath && data ? toPath(state, state.host.realpath(path)) : path, data] as const) )); if (state.watch) {