We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7fc5a29 commit 1ef31a7Copy full SHA for 1ef31a7
packages/vitest/src/node/plugins/normalizeURL.ts
@@ -24,7 +24,9 @@ export function NormalizeURLPlugin(): Plugin {
24
25
const cleanString = stripLiteral(code)
26
const assetImportMetaUrlRE
27
- = /\bnew\s+URL\s*\(\s*(?:'[^']+'|"[^"]+"|`[^`]+`)\s*,\s*import\.meta\.url\s*(?:,\s*)?\)/g
+ // vite injects new URL(path, import.meta.url) in the code
28
+ // rolldown-vite injects new URL(path, '' + import.meta.url) in the code
29
+ = /\bnew\s+URL\s*\(\s*(?:'[^']+'|"[^"]+"|`[^`]+`)\s*,\s*(?:'' \+ )?import\.meta\.url\s*(?:,\s*)?\)/g
30
31
let updatedCode = code
32
let match: RegExpExecArray | null
0 commit comments