diff --git a/packages/js/src/plugins/typescript/plugin.ts b/packages/js/src/plugins/typescript/plugin.ts index 60200b4fa1..f7914af6d6 100644 --- a/packages/js/src/plugins/typescript/plugin.ts +++ b/packages/js/src/plugins/typescript/plugin.ts @@ -104,18 +104,20 @@ export const createNodes: CreateNodes = [ return {}; } - const hash = calculateHashForCreateNodes( + const nodeHash = calculateHashForCreateNodes( projectRoot, pluginOptions, context, [getLockFileName(detectPackageManager(context.workspaceRoot))] ); + // The hash is calculated at the node/project level, so we add the config file path to avoid conflicts when caching + const cacheKey = `${nodeHash}_${configFilePath}`; - const targets = targetsCache[hash] - ? targetsCache[hash] + const targets = targetsCache[cacheKey] + ? targetsCache[cacheKey] : buildTscTargets(fullConfigPath, projectRoot, pluginOptions, context); - calculatedTargets[hash] = targets; + calculatedTargets[cacheKey] = targets; return { projects: {