From 228679871ad0140a77064341dc957ae45ab5aefa Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Mon, 4 Oct 2021 12:40:27 -0700 Subject: [PATCH] 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 3f0e366be3afe..e01810b5d714e 100644 --- a/src/compiler/tsbuildPublic.ts +++ b/src/compiler/tsbuildPublic.ts @@ -874,7 +874,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) {