Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(resolve): avoid tryFsResolve for /@fs/ paths #12450

Merged
merged 3 commits into from Apr 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/vite/src/node/plugins/resolve.ts
Expand Up @@ -207,12 +207,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