Skip to content

Commit

Permalink
perf(resolve): enable fast path for file urls (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 authored Feb 21, 2024
1 parent 4469e7b commit 5a52835
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ function _resolve(id: string, options: ResolveOptions = {}): string {
return "node:" + id;
}

// Skip resolve for absolute paths
// Enable fast path for file urls
if (id.startsWith("file:")) {
id = fileURLToPath(id);
}

// Skip resolve for absolute paths (fast path)
if (isAbsolute(id)) {
try {
const stat = statSync(id);
Expand Down

0 comments on commit 5a52835

Please sign in to comment.