Skip to content

Commit 88bb9cc

Browse files
committed
trim deps optimization hash from vite
1 parent 2952dce commit 88bb9cc

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

packages/vitest-pool-workers/src/pool/module-fallback.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,20 @@ async function viteResolve(
324324
return id;
325325
}
326326
// strip off deps optimization hash from vite
327-
return resolved.id.split("v=")[0];
327+
// @see https://github.com/cloudflare/workers-sdk/pull/5673
328+
if (resolved.id.includes("?v=")) {
329+
const [id, hash] = resolved.id.split("?v=");
330+
debuglog(
331+
"Trimming deps optimization hash from vite, id =",
332+
id,
333+
"v =",
334+
hash
335+
);
336+
337+
return id;
338+
}
339+
340+
return resolved.id;
328341
}
329342

330343
type ResolveMethod = "import" | "require";
@@ -477,6 +490,9 @@ async function load(
477490
filePath = trimSuffix(disableCjsEsmShimSuffix, filePath);
478491
}
479492

493+
// debuglog("Trimming ");
494+
// filePath = filePath.split("?v=")[0];
495+
480496
let isEsm =
481497
filePath.endsWith(".mjs") ||
482498
(filePath.endsWith(".js") && isWithinTypeModuleContext(filePath));

0 commit comments

Comments
 (0)