From 8c9fe0092a4181bc5b54a0f58c366a1d768ecd7d Mon Sep 17 00:00:00 2001 From: Jacob Parker Date: Wed, 13 Dec 2023 15:17:10 +0000 Subject: [PATCH] Fix static build when out dir is not within the cwd (#9378) * Fix static build when out dir is not within the cwd * Create lorem-ipsum-dolor Changeset --- .changeset/lorem-ipsum-dolor | 5 +++++ packages/astro/src/core/build/static-build.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/lorem-ipsum-dolor diff --git a/.changeset/lorem-ipsum-dolor b/.changeset/lorem-ipsum-dolor new file mode 100644 index 0000000000..15182e8f6c --- /dev/null +++ b/.changeset/lorem-ipsum-dolor @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes static builds when `config.outDir` is located outside of the astro project diff --git a/packages/astro/src/core/build/static-build.ts b/packages/astro/src/core/build/static-build.ts index 56910c4341..cd642aca0e 100644 --- a/packages/astro/src/core/build/static-build.ts +++ b/packages/astro/src/core/build/static-build.ts @@ -352,7 +352,7 @@ async function runPostBuildHooks( ? mutation.targets.includes('server') ? build.server : build.client - : config.outDir; + : getOutDirWithinCwd(config.outDir); const fullPath = path.join(fileURLToPath(root), fileName); const fileURL = pathToFileURL(fullPath); await fs.promises.mkdir(new URL('./', fileURL), { recursive: true });