Cleaning
Clean output directory before build
Cleaning
The clean option controls whether Packem empties the output directory before each build, so that stale artifacts from previous builds are not left behind.
import { defineConfig } from '@visulima/packem/config'
export default defineConfig({
clean: true,
})Default
clean defaults to true — the output directory is cleaned before every build.
Disabling cleaning
Set clean: false to keep existing files in the output directory:
export default defineConfig({
clean: false,
})CLI flag
There is a --no-clean flag on packem build that disables cleaning for a single build without editing the config file:
packem build --no-cleanThe flag is described as "Do not clean the dist directory before building". There is no separate --clean flag — cleaning is on by default, and --no-clean opts out.
The directory that gets cleaned is the resolved output directory (the outDir option, which defaults to your tsconfig outDir or dist).
Related Options
- Output Directory - Where build artifacts are written
- Watch Mode - Rebuild on file changes