Skip to content

Commit 7f9bcc3

Browse files
fix: windows drive letter casing
1 parent fbdd1a3 commit 7f9bcc3

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

  • packages/plugin-vite/src/plugins

packages/plugin-vite/src/plugins/deno.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ export function deno(): Plugin {
9393
resolved = path.fromFileUrl(resolved);
9494
}
9595

96+
resolved = fixWindowsDriveLetter(resolved);
97+
9698
return {
9799
id: resolved,
98100
meta: {
@@ -286,3 +288,18 @@ function maybeTransformJsxBrowser(
286288

287289
return null;
288290
}
291+
292+
function fixWindowsDriveLetter(filePath: string) {
293+
if (Deno.build.os === "windows") {
294+
// Vite does strict equality checks on absolute file paths
295+
// to load the client script. Ensure we match their casing.
296+
const match = filePath.match(/^(\w+):(.*)/);
297+
if (match !== null) {
298+
const drive = match[1];
299+
const rest = match[2];
300+
return `${drive.toUpperCase()}:${rest}`;
301+
}
302+
}
303+
304+
return filePath;
305+
}

0 commit comments

Comments
 (0)