esbuild-plugin-clean
ESBuild plugin for cleaning up output/assets before building.
Usage
Node: this plugin require ESBuild version ^0.11.19 for the onStart
/onEnd
hooks
GitHub Repository/Homepage is private for now, if you got any troubles, just open issue in this repo.
npm i esbuild-plugin-clean -D
pnpm i esbuild-plugin-clean -D
yarn add esbuild-plugin-clean -D
import { build } from 'esbuild';
import clean from 'esbuild-plugin-clean';
(async () => {
const res1 = await build({
entryPoints: ['./demo.ts'],
bundle: true,
outfile: './dist/main.js',
plugins: [
clean({
patterns: ['./dist/*'],
}),
],
});
})();
Configuration
This plugin use del under the hood, so you can easily pass del options to plugin.
export interface CleanOptions {
patterns?: string | string[];
dryRun?: boolean;
options?: DelOptions;
sync?: boolean;
cleanOn?: 'start' | 'end' | 'both';
}