Skip to content

Commit bfbfb00

Browse files
committed
fix: respect clean on watch mode
closes #633
1 parent e38b0e9 commit bfbfb00

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/features/clean.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export function resolveClean(
6666
return clean
6767
}
6868

69-
export async function cleanupChunks(
69+
export async function cleanChunks(
7070
outDir: string,
7171
chunks: Array<OutputAsset | OutputChunk>,
7272
): Promise<void> {

src/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
type ResolvedConfig,
1616
} from './config/index.ts'
1717
import { warnLegacyCJS } from './features/cjs.ts'
18-
import { cleanOutDir, cleanupChunks } from './features/clean.ts'
18+
import { cleanChunks, cleanOutDir } from './features/clean.ts'
1919
import { copy } from './features/copy.ts'
2020
import { createHooks, executeOnSuccess } from './features/hooks.ts'
2121
import { bundleDone, initBundleByPkg } from './features/pkg/index.ts'
@@ -196,7 +196,10 @@ export async function buildSingle(
196196
watcher.on('event', async (event) => {
197197
switch (event.code) {
198198
case 'START': {
199-
await cleanupChunks(config.outDir, chunks)
199+
if (config.clean) {
200+
await cleanChunks(config.outDir, chunks)
201+
}
202+
200203
chunks.length = 0
201204
hasError = false
202205
break

0 commit comments

Comments
 (0)