From c4a7ec4255e7acb9555cb8bb74ea13c5fbb2ac17 Mon Sep 17 00:00:00 2001 From: Arsh <69170106+lilnasy@users.noreply.github.com> Date: Mon, 9 Oct 2023 15:58:09 +0000 Subject: [PATCH 1/2] fix(windows): ensure drive letter is uppercase (#8741) --- .changeset/large-clouds-sip.md | 5 +++++ packages/astro/astro.js | 7 +++++++ 2 files changed, 12 insertions(+) create mode 100644 .changeset/large-clouds-sip.md diff --git a/.changeset/large-clouds-sip.md b/.changeset/large-clouds-sip.md new file mode 100644 index 000000000000..c271de43cc13 --- /dev/null +++ b/.changeset/large-clouds-sip.md @@ -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. diff --git a/packages/astro/astro.js b/packages/astro/astro.js index f227ae9e9704..b1b5106db566 100755 --- a/packages/astro/astro.js +++ b/packages/astro/astro.js @@ -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) => { From 7ea27f6319da6db7b3de8e22a11a80d0ac45872f Mon Sep 17 00:00:00 2001 From: ematipico Date: Mon, 9 Oct 2023 16:00:28 +0000 Subject: [PATCH 2/2] [ci] format --- packages/astro/astro.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/astro/astro.js b/packages/astro/astro.js index b1b5106db566..e067b9dd9b55 100755 --- a/packages/astro/astro.js +++ b/packages/astro/astro.js @@ -32,12 +32,12 @@ 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) - } + // 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))