Only set package data map under watch mode (#46211) (#46235)

Co-authored-by: Wesley Wigham <wewigham@microsoft.com>
This commit is contained in:
Daniel Rosenwasser 2021-10-06 16:10:53 -07:00 committed by GitHub
parent 34988fd49e
commit f54ef83161
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -871,12 +871,12 @@ namespace ts {
getConfigFileParsingDiagnostics(config),
config.projectReferences
);
state.lastCachedPackageJsonLookups.set(projectPath, state.moduleResolutionCache && map(
state.moduleResolutionCache.getPackageJsonInfoCache().entries(),
([path, data]) => ([state.host.realpath && data ? toPath(state, state.host.realpath(path)) : path, data] as const)
));
if (state.watch) {
state.lastCachedPackageJsonLookups.set(projectPath, state.moduleResolutionCache && map(
state.moduleResolutionCache.getPackageJsonInfoCache().entries(),
([path, data]) => ([state.host.realpath && data ? toPath(state, state.host.realpath(path)) : path, data] as const)
));
state.builderPrograms.set(projectPath, program);
}
step++;