Registry / devops / esbuild-plugin-clear

esbuild-plugin-clear

JSON →
library1.0.1jsnpmunverified

An esbuild plugin that clears a specified directory before each build. Version 1.0.0 is current, no known release cadence. It is a simple utility plugin that removes all files in the given directory path. Differentiates by being lightweight and dependency-free, unlike broader cleanup tools like rimraf or del integrated into build systems.

npm install esbuild-plugin-clear
INSTALL
IMPORT
SIG · ESBUILD-PLUGIN-CLE
E
esbuild-plugin-clear
devopsjavascriptv1.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default (clear)
import clear from 'esbuild-plugin-clear'
const clear = require('esbuild-plugin-clear')
Package uses default export and is ESM-first; require() may work only in some environments.
clear as named import
import { default as clear } from 'esbuild-plugin-clear'
import { clear } from 'esbuild-plugin-clear'
Symbol is not named; use default import or alias default.
Used as plugin in esbuild
clear('./dist')
clear({ path: './dist' })
The plugin function takes a string argument (directory path), not an options object.

Shows basic usage: importing the clear plugin and passing the directory to clear before building.

import esbuild from 'esbuild'; import clear from 'esbuild-plugin-clear'; esbuild.build({ entryPoints: ['./src/index.js'], bundle: true, outfile: './dist/index.js', plugins: [ clear('./dist') ] }).catch(() => process.exit(1));
Debug
Known issues
gotchaThe plugin deletes the entire given directory contents recursively without confirmation. Ensure the path is correct.
fix
Double-check the directory path before running the build.
affects: all
gotchaIf the directory does not exist, the plugin may throw an error (depending on filesystem permissions).
fix
Ensure the target directory exists or handle the error gracefully.
affects: all
Errors
Common errors & fixes
Error: Cannot find module 'esbuild-plugin-clear'
Package not installed or installed as devDependency but not resolved.
fix
Run 'npm install --save-dev esbuild-plugin-clear' and ensure node_modules contains it.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
esbuild-plugin-clear — npm install esbuild-plugin-clear · libregistry