Check vite.emptyOutDir before emptying dir (#6153)
* Check vite.emptyOutDir before emptying dir * Fix: add .build to object path * Update packages/astro/src/core/build/static-build.ts Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com> * Create flat-dolphins-admire.md --------- Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
This commit is contained in:
parent
9fdecb5606
commit
1b591a1431
2 changed files with 8 additions and 1 deletions
5
.changeset/flat-dolphins-admire.md
Normal file
5
.changeset/flat-dolphins-admire.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"astro": patch
|
||||
---
|
||||
|
||||
Respect `vite.build.emptyOutDir` setting during `astro build`
|
|
@ -61,7 +61,9 @@ export async function staticBuild(opts: StaticBuildOptions) {
|
|||
// Empty out the dist folder, if needed. Vite has a config for doing this
|
||||
// but because we are running 2 vite builds in parallel, that would cause a race
|
||||
// condition, so we are doing it ourselves
|
||||
emptyDir(settings.config.outDir, new Set('.git'));
|
||||
if (settings.config?.vite?.build?.emptyOutDir !== false) {
|
||||
emptyDir(settings.config.outDir, new Set('.git'));
|
||||
}
|
||||
|
||||
// Register plugins
|
||||
const container = createPluginContainer(opts, internals);
|
||||
|
|
Loading…
Reference in a new issue