From 55331670b42d2d792fd35f9e8d7754cdeae8f120 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Wed, 15 Nov 2023 20:21:53 +0900 Subject: [PATCH] fix: don't append `/@fs/` for bare imports --- packages/vite/src/node/plugins/importAnalysis.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/vite/src/node/plugins/importAnalysis.ts b/packages/vite/src/node/plugins/importAnalysis.ts index 528b68a221dcc5..08b827d4d8fb75 100644 --- a/packages/vite/src/node/plugins/importAnalysis.ts +++ b/packages/vite/src/node/plugins/importAnalysis.ts @@ -335,7 +335,8 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin { url = resolved.id.slice(root.length) } else if ( depsOptimizer?.isOptimizedDepFile(resolved.id) || - fs.existsSync(cleanUrl(resolved.id)) + (path.isAbsolute(cleanUrl(resolved.id)) && + fs.existsSync(cleanUrl(resolved.id))) ) { // an optimized deps may not yet exists in the filesystem, or // a regular file exists but is out of root: rewrite to absolute /@fs/ paths