Skip to content

Commit a6c16c5

Browse files
windows fix
1 parent 7f9bcc3 commit a6c16c5

1 file changed

Lines changed: 6 additions & 17 deletions

File tree

  • packages/plugin-vite/src/plugins

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

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ export function deno(): Plugin {
6565
id = tmp.id;
6666
}
6767

68+
// Plugins may return lower cased drive letters on windows
69+
if (path.isAbsolute(id)) {
70+
id = path.toFileUrl(path.normalize(id))
71+
.href;
72+
}
73+
6874
try {
6975
// Ensure we're passing a valid importer that Deno understands
7076
const denoImporter = importer && !importer.startsWith("\0")
@@ -93,8 +99,6 @@ export function deno(): Plugin {
9399
resolved = path.fromFileUrl(resolved);
94100
}
95101

96-
resolved = fixWindowsDriveLetter(resolved);
97-
98102
return {
99103
id: resolved,
100104
meta: {
@@ -288,18 +292,3 @@ function maybeTransformJsxBrowser(
288292

289293
return null;
290294
}
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)