From 0e4e91d033047540151e57b524f6b5e2ebb262a7 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Wed, 14 Feb 2024 20:17:58 +0900 Subject: [PATCH] fix(runtime): pass path instead of fileURL to isFilePathESM --- 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 }