* Resolves #4825 * Add changeset * Update late-cups-jam.md * Update late-cups-jam.md
This commit is contained in:
parent
3389f0ce91
commit
4b092269c1
2 changed files with 12 additions and 5 deletions
5
.changeset/late-cups-jam.md
Normal file
5
.changeset/late-cups-jam.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
copy assets even if outDir is out of process.cwd()
|
|
@ -242,11 +242,6 @@ async function clientBuild(
|
||||||
|
|
||||||
async function cleanSsrOutput(opts: StaticBuildOptions) {
|
async function cleanSsrOutput(opts: StaticBuildOptions) {
|
||||||
const out = getOutDirWithinCwd(opts.settings.config.outDir);
|
const out = getOutDirWithinCwd(opts.settings.config.outDir);
|
||||||
// Clean out directly if the outDir is outside of root
|
|
||||||
if (out.toString() !== opts.settings.config.outDir.toString()) {
|
|
||||||
await fs.promises.rm(out, { recursive: true });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// The SSR output is all .mjs files, the client output is not.
|
// The SSR output is all .mjs files, the client output is not.
|
||||||
const files = await glob('**/*.mjs', {
|
const files = await glob('**/*.mjs', {
|
||||||
cwd: fileURLToPath(out),
|
cwd: fileURLToPath(out),
|
||||||
|
@ -257,6 +252,13 @@ async function cleanSsrOutput(opts: StaticBuildOptions) {
|
||||||
await fs.promises.rm(url);
|
await fs.promises.rm(url);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
// Clean out directly if the outDir is outside of root
|
||||||
|
if (out.toString() !== opts.settings.config.outDir.toString()) {
|
||||||
|
// Copy assets before cleaning directory if outside root
|
||||||
|
copyFiles(out, opts.settings.config.outDir);
|
||||||
|
await fs.promises.rm(out, { recursive: true });
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function copyFiles(fromFolder: URL, toFolder: URL) {
|
async function copyFiles(fromFolder: URL, toFolder: URL) {
|
||||||
|
|
Loading…
Reference in a new issue