Skip to content

Commit 3ef8aaa

Browse files
authoredApr 6, 2023
perf(resolve): avoid tryFsResolve for /@fs/ paths (#12450)
1 parent d202588 commit 3ef8aaa

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed
 

‎packages/vite/src/node/plugins/resolve.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,12 @@ export function resolvePlugin(resolveOptions: InternalResolveOptions): Plugin {
206206

207207
// explicit fs paths that starts with /@fs/*
208208
if (asSrc && id.startsWith(FS_PREFIX)) {
209-
const fsPath = fsPathFromId(id)
210-
res = tryFsResolve(fsPath, options)
211-
debug?.(`[@fs] ${colors.cyan(id)} -> ${colors.dim(res)}`)
209+
res = fsPathFromId(id)
210+
// We don't need to resolve these paths since they are already resolved
212211
// always return here even if res doesn't exist since /@fs/ is explicit
213-
// if the file doesn't exist it should be a 404
214-
return ensureVersionQuery(res || fsPath, id, options, depsOptimizer)
212+
// if the file doesn't exist it should be a 404.
213+
debug?.(`[@fs] ${colors.cyan(id)} -> ${colors.dim(res)}`)
214+
return ensureVersionQuery(res, id, options, depsOptimizer)
215215
}
216216

217217
// URL

0 commit comments

Comments
 (0)
Please sign in to comment.