fix(js): typescript plugin target hashing (#23073)

This commit is contained in:
James Henry 2024-04-29 18:51:32 +01:00 committed by GitHub
parent 3cf13ab864
commit addde70251
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -104,18 +104,20 @@ export const createNodes: CreateNodes<TscPluginOptions> = [
return {}; return {};
} }
const hash = calculateHashForCreateNodes( const nodeHash = calculateHashForCreateNodes(
projectRoot, projectRoot,
pluginOptions, pluginOptions,
context, context,
[getLockFileName(detectPackageManager(context.workspaceRoot))] [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] const targets = targetsCache[cacheKey]
? targetsCache[hash] ? targetsCache[cacheKey]
: buildTscTargets(fullConfigPath, projectRoot, pluginOptions, context); : buildTscTargets(fullConfigPath, projectRoot, pluginOptions, context);
calculatedTargets[hash] = targets; calculatedTargets[cacheKey] = targets;
return { return {
projects: { projects: {