From 39ca0d0793c7a271c91be3c42136ef06b43db27e Mon Sep 17 00:00:00 2001 From: yzydeveloper Date: Thu, 13 Oct 2022 03:28:27 +0800 Subject: [PATCH] fix: When fileUrl is an absolute path, the path parameter will be cleared --- packages/vite/src/node/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vite/src/node/utils.ts b/packages/vite/src/node/utils.ts index 2711a29b7eb703..9fe1be5957f8db 100644 --- a/packages/vite/src/node/utils.ts +++ b/packages/vite/src/node/utils.ts @@ -323,7 +323,7 @@ export function injectQuery(url: string, queryToInject: string): string { // encode percents for consistent behavior with pathToFileURL // see #2614 for details let resolvedUrl = new URL(url.replace(/%/g, '%25'), 'relative:///') - if (resolvedUrl.protocol !== 'relative:') { + if (resolvedUrl.protocol === 'file:') { resolvedUrl = pathToFileURL(url) } const { search, hash } = resolvedUrl