Skip to content

Commit

Permalink
fix(windows): ensure drive letter is uppercase (#8741)
Browse files Browse the repository at this point in the history
  • Loading branch information
lilnasy authored Oct 9, 2023
1 parent a0dc79b commit c4a7ec4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/large-clouds-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fixed an issue on Windows where lowercase drive letters in current working directory led to missing scripts and styles.
7 changes: 7 additions & 0 deletions packages/astro/astro.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ async function main() {
}
}

// windows drive letters can sometimes be lowercase, which vite cannot process
if (process.platform === 'win32') {
const cwd = process.cwd()
const correctedCwd = cwd.slice(0, 1).toUpperCase() + cwd.slice(1)
if (correctedCwd !== cwd) process.chdir(correctedCwd)
}

return import('./dist/cli/index.js')
.then(({ cli }) => cli(process.argv))
.catch((error) => {
Expand Down

0 comments on commit c4a7ec4

Please sign in to comment.