File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
packages/bundler-shared-config/src/provider Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -39,3 +39,4 @@ screenshot
3939.eslintcache
4040
4141build
42+ .takumi /todos
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import type {
55 Stats ,
66} from '@kmijs/bundler-shared/rspack'
77import type { Configuration } from '@kmijs/bundler-shared/rspack'
8- import { logger } from '@kmijs/shared'
8+ import { logger , rimraf } from '@kmijs/shared'
99import { Env , type IUserConfig } from '../types'
1010import { esbuildCompressErrorHelper } from '../utils/esbuildCompressErrorHelper'
1111import type {
@@ -72,6 +72,23 @@ export abstract class BaseBundler<
7272 let isFirstCompile = true
7373
7474 return new Promise ( ( resolve , reject ) => {
75+ if ( opts . clean ) {
76+ bundlerConfigs . forEach ( ( config ) => {
77+ if ( config . output ?. path ) {
78+ try {
79+ logger . verbose (
80+ `[BaseBundler] Cleaning output directory: ${ config . output . path } ` ,
81+ )
82+ rimraf . sync ( config . output . path )
83+ } catch ( error ) {
84+ logger . verbose (
85+ `[BaseBundler] Cleaning output directory: ${ config . output . path } failed` ,
86+ )
87+ }
88+ }
89+ } )
90+ }
91+
7592 const compiler = this . createCompiler ( {
7693 ...buildOptions ,
7794 bundlerConfigs,
You can’t perform that action at this time.
0 commit comments