A Rollup plugin that automatically empties output directories before each build. Version 3.0.0 requires Rollup >=4.0.0 and runs on the `buildStart` hook with `order: 'pre'` by default, ensuring cleanup happens before any other plugin. The plugin forces an explicit `OUT_DIR` argument (optional in v2 but required in v3). It ships TypeScript definitions. Compared to similar plugins like `rollup-plugin-clean`, it is minimal and focused, with no extra features. Release cadence is low; major versions align with Rollup major upgrades.
npm install rollup-plugin-cleandirVerified import paths — ran on the pinned version, not inferred.
Shows basic usage: import the named export and pass the output directory as the first argument.
Always pass the output directory path as the first argument to cleandir().
Upgrade Rollup to v2 or higher, or stay on v1.x of the plugin.
If you need a different ordering, use the options argument to specify a custom hook and/or order.
Install the package: `npm install --save-dev rollup-plugin-cleandir` and use named import: `import { cleandir } from 'rollup-plugin-cleandir'`.Use named import: `import { cleandir } from 'rollup-plugin-cleandir'`Pass the output directory path as the first argument: `cleandir('dist')`.