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)
  • Loading branch information
Coly010 committed Apr 3, 2024
1 parent 6db0563 commit 2149fa2
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 2149fa2

Please sign in to comment.