fix(core): ensure cache pathMappings always exist

This commit is contained in:
James Henry 2021-07-23 13:29:24 +04:00 committed by Victor Savkin
parent a9afb97307
commit fedcfc4725

View File

@ -83,7 +83,7 @@ export function readCache(): false | ProjectGraphCache {
export function writeCache( export function writeCache(
packageJsonDeps: Record<string, string>, packageJsonDeps: Record<string, string>,
nxJson: NxJsonConfiguration, nxJson: NxJsonConfiguration,
tsConfig: { compilerOptions: { paths: { [k: string]: any } } }, tsConfig: { compilerOptions: { paths?: { [k: string]: any } } },
projectGraph: ProjectGraph projectGraph: ProjectGraph
): void { ): void {
performance.mark('write cache:start'); performance.mark('write cache:start');
@ -94,7 +94,7 @@ export function writeCache(
const newValue: ProjectGraphCache = { const newValue: ProjectGraphCache = {
version: '3.0', version: '3.0',
deps: packageJsonDeps, deps: packageJsonDeps,
pathMappings: tsConfig.compilerOptions.paths, pathMappings: tsConfig.compilerOptions.paths || {},
nxJsonPlugins, nxJsonPlugins,
nodes: projectGraph.nodes, nodes: projectGraph.nodes,
dependencies: projectGraph.dependencies, dependencies: projectGraph.dependencies,