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.

devopsweb-framework
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.

Package uses default export and is ESM-first; require() may work only in some environments.

import clear from 'esbuild-plugin-clear'

Symbol is not named; use default import or alias default.

import { default as clear } from 'esbuild-plugin-clear'

The plugin function takes a string argument (directory path), not an options object.

clear('./dist')

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 footguns
gotchaThe plugin deletes the entire given directory contents recursively without confirmation. Ensure the path is correct.
gotchaIf the directory does not exist, the plugin may throw an error (depending on filesystem permissions).
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
9 hits · last 30 days
gptbot
3
ahrefsbot
3
claudebot
3
Resources