From 157b9153ad2b623bc0196055971af84e5d6cfa8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnaud=20Barr=C3=A9?= Date: Thu, 11 Aug 2022 23:00:55 +0200 Subject: [PATCH] fix(config): Don't use file url for external files with cjs output --- packages/vite/src/node/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index fa0a25e463b811..f29d06e27e29e2 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -980,7 +980,7 @@ async function bundleConfigFile( if (path.relative(idPkgDir, fileName).startsWith('..')) { return { // normalize actual import after bundled as a single vite config - path: pathToFileURL(idFsPath).href, + path: isESM ? pathToFileURL(idFsPath).href : idFsPath, external: true } }