{"id":25323,"library":"esbuild-plugin-clear","title":"esbuild-plugin-clear","description":"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.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/DasRed/esbuild-plugin-clear","tags":["javascript","esbuild","plugin","clear"],"install":[{"cmd":"npm install esbuild-plugin-clear","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-plugin-clear","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-plugin-clear","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package uses default export and is ESM-first; require() may work only in some environments.","wrong":"const clear = require('esbuild-plugin-clear')","symbol":"default (clear)","correct":"import clear from 'esbuild-plugin-clear'"},{"note":"Symbol is not named; use default import or alias default.","wrong":"import { clear } from 'esbuild-plugin-clear'","symbol":"clear as named import","correct":"import { default as clear } from 'esbuild-plugin-clear'"},{"note":"The plugin function takes a string argument (directory path), not an options object.","wrong":"clear({ path: './dist' })","symbol":"Used as plugin in esbuild","correct":"clear('./dist')"}],"quickstart":{"code":"import esbuild from 'esbuild';\nimport clear from 'esbuild-plugin-clear';\n\nesbuild.build({\n    entryPoints: ['./src/index.js'],\n    bundle: true,\n    outfile: './dist/index.js',\n    plugins: [\n        clear('./dist')\n    ]\n}).catch(() => process.exit(1));","lang":"javascript","description":"Shows basic usage: importing the clear plugin and passing the directory to clear before building."},"warnings":[{"fix":"Double-check the directory path before running the build.","message":"The plugin deletes the entire given directory contents recursively without confirmation. Ensure the path is correct.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure the target directory exists or handle the error gracefully.","message":"If the directory does not exist, the plugin may throw an error (depending on filesystem permissions).","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'npm install --save-dev esbuild-plugin-clear' and ensure node_modules contains it.","cause":"Package not installed or installed as devDependency but not resolved.","error":"Error: Cannot find module 'esbuild-plugin-clear'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}