Registry / devops / rollup-plugin-cleandir

rollup-plugin-cleandir

JSON →
library3.0.0jsnpmunverified

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-cleandir
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-CLEA
R
rollup-plugin-cleandir
devopsjavascriptv3.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

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

cleandir
import { cleandir } from 'rollup-plugin-cleandir'
import cleandir from 'rollup-plugin-cleandir'
Named export only. Default import does not work.
cleandir (CommonJS)
const { cleandir } = require('rollup-plugin-cleandir')
const cleandir = require('rollup-plugin-cleandir').default
CommonJS users must destructure the named export.
type CleandirOptions
import type { CleandirOptions } from 'rollup-plugin-cleandir'
TypeScript users can import the options type for better autocompletion.

Shows basic usage: import the named export and pass the output directory as the first argument.

// rollup.config.js import { cleandir } from 'rollup-plugin-cleandir'; export default { input: 'src/index.js', output: { dir: 'dist', format: 'es', }, plugins: [cleandir('dist')], };
Debug
Known issues
breakingOUT_DIR is now required in v3.0.0
fix
Always pass the output directory path as the first argument to cleandir().
affects: >=3.0.0
breakingv2.0.0 requires Rollup >=2.0.0
fix
Upgrade Rollup to v2 or higher, or stay on v1.x of the plugin.
affects: >=2.0.0 <3.0.0
gotchaPlugin uses `buildStart` hook with `order:'pre'`; may run before other plugins that also use the same hook with `order:'pre'`
fix
If you need a different ordering, use the options argument to specify a custom hook and/or order.
affects: >=3.0.0
Errors
Common errors & fixes
Cannot find module 'rollup-plugin-cleandir'
Missing installation or incorrect import style.
fix
Install the package: `npm install --save-dev rollup-plugin-cleandir` and use named import: `import { cleandir } from 'rollup-plugin-cleandir'`.
TypeError: cleandir is not a function
Using default import or wrong import style.
fix
Use named import: `import { cleandir } from 'rollup-plugin-cleandir'`
Error: OUT_DIR is required
cleandir() called without arguments in v3.0.0.
fix
Pass the output directory path as the first argument: `cleandir('dist')`.
Upgrade
Version history
3.0.0latest on npm
Audit
Dependencies
rolluprequiredpeer dependency: plugin requires Rollup >=4.0.0
Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
1
Resources
rollup-plugin-cleandir — npm install rollup-plugin-cleandir · libregistry