diff --git a/.changeset/lorem-ipsum-dolor b/.changeset/lorem-ipsum-dolor new file mode 100644 index 000000000000..15182e8f6cd5 --- /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 56910c434130..cd642aca0ed1 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 });