Skip to content

Commit 8976c24

Browse files
committed
fix(test/build): clean dist before bundling vitest
bundleVitest copied vitest's distribution into packages/test/dist without cleaning the directory first. When the upstream vitest version changed, the new build emitted hashed chunks with new names (e.g. cac.<new-hash>.js) but stale chunks from the previous version lingered. The later brandVitest step iterates every cac.*.js chunk looking for cac("vitest") and threw when it hit a stale chunk whose pattern was absent or already rewritten, breaking pnpm bootstrap-cli. Clear dist/ at the start of bundleVitest so each build starts from a known-empty tree.
1 parent 3dd881b commit 8976c24

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

packages/test/build.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,10 @@ async function mergePackageJson(pluginExports: Array<{ exportPath: string; shimF
436436
async function bundleVitest() {
437437
const vitestDestDir = projectDir;
438438

439+
// Clean dist/ so chunks from a previous vitest version don't linger.
440+
// Stale hashed chunks (e.g. cac.<old-hash>.js) trip later patch steps
441+
// when the new build only emits cac.<new-hash>.js.
442+
await rm(distDir, { recursive: true, force: true });
439443
await mkdir(vitestDestDir, { recursive: true });
440444

441445
// Get all vitest files excluding node_modules and package.json

0 commit comments

Comments
 (0)