Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–223 runs
build_error
glibcnode 18–223 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
clean
✓ import { clean } from 'esbuild-plugin-clean'
✗ import clean from 'esbuild-plugin-clean'
Named export, not default.
CleanOptions
✓ import type { CleanOptions } from 'esbuild-plugin-clean'
✗ import { CleanOptions } from 'esbuild-plugin-clean'
CleanOptions is a type, use 'import type' in TypeScript to avoid runtime issues.
clean
✓ const { clean } = require('esbuild-plugin-clean')
✗ const clean = require('esbuild-plugin-clean')
CommonJS require with destructuring for named export.
Shows how to use the clean plugin with ESBuild, including patterns for start and end, and configuration options.
import { build } from 'esbuild';
import { clean } from 'esbuild-plugin-clean';
(async () => {
await build({
entryPoints: ['./src/index.ts'],
bundle: true,
outdir: './dist',
plugins: [
clean({
patterns: ['./dist/*'],
cleanOnStartPatterns: ['./prepare'],
cleanOnEndPatterns: ['./post'],
dryRun: false,
sync: true,
verbose: true,
}),
],
});
})();
Errors
Common errors & fixes
Error: The plugin "clean" is not compatible with ESBuild version 0.12.x
Using an older version of esbuild (<0.14.0).
fixInstall esbuild >= 0.14.0: npm install esbuild@latest
TypeError: clean is not a function
Incorrect import: using default import instead of named import.
fixUse import { clean } from 'esbuild-plugin-clean' Cannot find module 'del'
Missing peer dependency 'del'.
fixInstall del: npm install del
Audit
Dependencies
esbuildrequiredPlugin for ESBuild, required to run as a plugin inside ESBuild.
delrequiredUsed under the hood for file deletion; the plugin accepts del options.