Skip to content

Commit

Permalink
perf(resolve): avoid tryFsResolve for /@fs/ paths (#12450)
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev committed Apr 6, 2023
1 parent d202588 commit 3ef8aaa
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/vite/src/node/plugins/resolve.ts
Expand Up @@ -206,12 +206,12 @@ export function resolvePlugin(resolveOptions: InternalResolveOptions): Plugin {

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

// URL
Expand Down

0 comments on commit 3ef8aaa

Please sign in to comment.