From 062908a2c60301e1963e7038c753d447e5786b81 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Tue, 29 Oct 2024 13:34:28 +0900 Subject: [PATCH] fix: rewrite file URL --- packages/vite/src/node/plugins/importAnalysis.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/vite/src/node/plugins/importAnalysis.ts b/packages/vite/src/node/plugins/importAnalysis.ts index a7a77968ea5550..8281c1bcbedd17 100644 --- a/packages/vite/src/node/plugins/importAnalysis.ts +++ b/packages/vite/src/node/plugins/importAnalysis.ts @@ -509,7 +509,10 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin { // If resolvable, let's resolve it if (specifier !== undefined) { // skip external / data uri - if (isExternalUrl(specifier) || isDataUrl(specifier)) { + if ( + (isExternalUrl(specifier) && !specifier.startsWith('file://')) || + isDataUrl(specifier) + ) { return } // skip ssr externals and builtins