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) {