Skip to content

Commit 0435303

Browse files
committed
Simplify cache access
1 parent ac0c9aa commit 0435303

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/compiler/moduleNameResolver.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -961,13 +961,7 @@ namespace ts {
961961
trace(state.host, Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName);
962962
}
963963
const baseDirectory = getPathsBasePath(state.compilerOptions, state.host)!; // Always defined when 'paths' is defined
964-
let pathPatterns: readonly (string | Pattern)[] | undefined;
965-
if (configFile?.configFileSpecs) {
966-
pathPatterns = configFile.configFileSpecs.pathPatterns;
967-
if (!pathPatterns) {
968-
configFile.configFileSpecs.pathPatterns = pathPatterns = tryParsePatterns(paths);
969-
}
970-
}
964+
const pathPatterns = configFile?.configFileSpecs ? configFile.configFileSpecs.pathPatterns ||= tryParsePatterns(paths) : undefined;
971965
return tryLoadModuleUsingPaths(extensions, moduleName, baseDirectory, paths, pathPatterns, loader, /*onlyRecordFailures*/ false, state);
972966
}
973967
}

0 commit comments

Comments
 (0)