Skip to content

Commit

Permalink
only override response filename when vite has messed with it
Browse files Browse the repository at this point in the history
  • Loading branch information
ef4 committed Dec 12, 2024
1 parent 28ebc3c commit 1892fb8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/vite/src/esbuild-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,19 @@ export class EsBuildRequestAdapter implements RequestAdapter<Resolution<OnResolv
}
}

let filename: string;
if (status.type === 'found' && result.external) {
// when we know that the file was really found, but vite has
// externalized it, report the true filename that was found, not the
// externalized request path.
filename = status.filename;
} else {
filename = result.path;
}

return {
type: 'found',
filename: status.type === 'found' ? status.filename : result.path,
filename,
result,
isVirtual: false,
};
Expand Down

0 comments on commit 1892fb8

Please sign in to comment.