Skip to content

Commit

Permalink
fix(vite): ensure cache is created correctly for separate vite and vi…
Browse files Browse the repository at this point in the history
…test config files #22244 (#22618)

(cherry picked from commit 2149fa2)
  • Loading branch information
Coly010 authored and FrozenPandaz committed Apr 5, 2024
1 parent f6f2b3a commit 9a3c4fa
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/vite/src/plugins/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,12 @@ export const createNodes: CreateNodes<VitePluginOptions> = [

options = normalizeOptions(options);

const hash = calculateHashForCreateNodes(projectRoot, options, context, [
getLockFileName(detectPackageManager(context.workspaceRoot)),
]);
// 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, [
getLockFileName(detectPackageManager(context.workspaceRoot)),
]) + configFilePath;
const targets = targetsCache[hash]
? targetsCache[hash]
: await buildViteTargets(configFilePath, projectRoot, options, context);
Expand Down

0 comments on commit 9a3c4fa

Please sign in to comment.