esbuild-clean-plugin
v1.0.0
Published
An esbuild plugin to clean your build folder.
Downloads
1,971
Readme
esbuild-clean-plugin
An esbuild plugin to clean your build folder.
Installation
npm install esbuild-clean-plugin
Requirements
- Node 14.15.0 (LTS) or later.
- esbuild 0.11.18 or later.
Usage
import { build } from 'esbuild';
import { cleanPlugin } from 'esbuild-plugin-clean';
build({
bundle: true,
entryPoints: [path.resolve(__dirname, 'index.js')],
metafile: true,
outdir: path.resolve(__dirname, 'dist'),
watch: true,
plugins: [cleanPlugin({
// Plugin options
})],
});
Note: The metafile
and outdir
options must be set for the plugin to have any effect.
Options
dry
(defaultfalse
) - Run the plugin in dry mode, not deleting anything. Most useful together with theverbose
option to see what would have been deleted.initialCleanPatterns
(default['**/*']
) - File patterns to remove on plugin setup, useful to clean the build directory before creating new files. Pass an empty array to disable it.verbose
(defaultfalse
) - Print all files that have been deleted after each run.