fix(bundling): fix vite plugin caching (#26487)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

## Current Behavior
<!-- This is the behavior we have today -->

A missing await caused the hash for the cache file name to be the same
for different options.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

The hash for the cache file name is different for different options.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
This commit is contained in:
Jason Jean 2024-06-10 10:12:08 -04:00 committed by GitHub
parent 9280c9a8d9
commit ccc5ad5db4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -65,9 +65,9 @@ export const createNodes: CreateNodes<VitePluginOptions> = [
// We do not want to alter how the hash is calculated, so appending the config file path to the hash
// to prevent vite/vitest files overwriting the target cache created by the other
const hash =
calculateHashForCreateNodes(projectRoot, options, context, [
(await calculateHashForCreateNodes(projectRoot, options, context, [
getLockFileName(detectPackageManager(context.workspaceRoot)),
]) + configFilePath;
])) + configFilePath;
targetsCache[hash] ??= await buildViteTargets(
configFilePath,