Skip to content

Commit 2a519a1

Browse files
authored
fix: don't append /@fs/ for bare imports (#14995)
1 parent d3af879 commit 2a519a1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/vite/src/node/plugins/importAnalysis.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,8 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
335335
url = resolved.id.slice(root.length)
336336
} else if (
337337
depsOptimizer?.isOptimizedDepFile(resolved.id) ||
338-
fs.existsSync(cleanUrl(resolved.id))
338+
(path.isAbsolute(cleanUrl(resolved.id)) &&
339+
fs.existsSync(cleanUrl(resolved.id)))
339340
) {
340341
// an optimized deps may not yet exists in the filesystem, or
341342
// a regular file exists but is out of root: rewrite to absolute /@fs/ paths

0 commit comments

Comments
 (0)