用于构建前清理上次构建的产物
pnpm install vite-plugin-clean -D
import { defineConfig } from 'vite'
import vitePluginClean from 'vite-plugin-clean'
export default defineConfig({
plugins: [
vitePluginClean()
]
})
export type PluginOptions = {
folder: string | string[]
hooks?: {
buildStart?: () => void | Promise<void>
closeBundle?: () => void | Promise<void>
}
}
export default defineConfig({
plugins: [
vitePluginClean({
folder: 'dist', // default: dist or ['dist'] or ['dist', 'lib']
hooks: {
buildStart() {
console.log('build start')
}
}
})
]
})