From 7b1560765e474869c2f2096cff6d519ef01afe48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Wed, 14 Feb 2024 22:35:40 +0900 Subject: [PATCH] fix(runtime): pass path instead of fileURL to `isFilePathESM` (#15908) --- packages/vite/src/node/ssr/fetchModule.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vite/src/node/ssr/fetchModule.ts b/packages/vite/src/node/ssr/fetchModule.ts index e62d5b25d1f2d3..855e3c2b467133 100644 --- a/packages/vite/src/node/ssr/fetchModule.ts +++ b/packages/vite/src/node/ssr/fetchModule.ts @@ -77,7 +77,7 @@ export async function fetchModule( throw err } const file = pathToFileURL(resolved.id).toString() - const type = isFilePathESM(file, server.config.packageCache) + const type = isFilePathESM(resolved.id, server.config.packageCache) ? 'module' : 'commonjs' return { externalize: file, type }