ESBuild plugin that automatically clears the output directory before each build, ensuring a clean build state by removing old files. Version 2.0.2 is the current stable release, with no recent updates. It is a lightweight, single-purpose plugin that integrates seamlessly with ESBuild's plugin system. Unlike manual cleanup scripts, it runs as part of the ESBuild build process and respects the configured outdir or outfile paths. Ships with TypeScript type definitions.
npm install esbuild-plugin-output-resetNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows the minimal setup to use the plugin with ESBuild's build API, cleaning the dist folder before each build.
Ensure the output directory is dedicated solely to the build output.
Always specify either outdir or outfile in your ESBuild options.
If using older version, update the import and usage: the plugin is now used as import clear from 'esbuild-plugin-output-reset' and passed directly to plugins array.
Switch to default import: import clear from 'esbuild-plugin-output-reset'.
Change import { clear } from 'esbuild-plugin-output-reset' to import clear from 'esbuild-plugin-output-reset'.Upgrade esbuild to version 0.17 or later.
Run npm install esbuild-plugin-output-reset --save-dev (or your package manager equivalent).