Registry / devops / rollup-plugin-delete

rollup-plugin-delete

JSON →
library3.0.2jsnpmunverified

A Rollup plugin for deleting files and folders before or during a build, powered by the del package. Current stable version is 3.0.2, released as pure ESM requiring Node.js 18+. It is written in TypeScript and ships native types. Key differentiators include support for multiple target patterns, verbose output, customizable hook (e.g., buildStart, buildEnd), and a runOnce option for watch mode. Active maintenance with recent updates focused on modernizing internals (vitest to node test runner, tsdown).

npm install rollup-plugin-delete
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-DELE
R
rollup-plugin-delete
devopsjavascriptv3.0.2
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.

del
import del from 'rollup-plugin-delete'
const del = require('rollup-plugin-delete')
Default export is the plugin factory. The package is ESM-only since v3, requiring import syntax.
DelOptions
import type { DelOptions } from 'rollup-plugin-delete'
import { DelOptions } from 'rollup-plugin-delete'
TypeScript users should import types with 'import type' to avoid runtime inclusion.
RollupPluginDeleteOptions
import type { RollupPluginDeleteOptions } from 'rollup-plugin-delete'
Type alias for the plugin's configuration object; available since v3 with TypeScript rewrite.

Shows basic usage: delete all files in 'dist' before bundle, with verbose output and runOnce to avoid re-deletion in watch mode.

// rollup.config.js import del from 'rollup-plugin-delete'; export default { input: 'src/index.js', output: { file: 'dist/bundle.js' }, plugins: [ del({ targets: 'dist/*', verbose: true, runOnce: true }) ] };
Debug
Known issues
breakingPackage converted to pure ESM in v3.0.0 - require() will throw an error
fix
Use import syntax instead of require(). If you must use CommonJS, stay on v2.x.
affects: >=3.0.0
breakingRequires Node.js 18+ starting from v3.0.0
fix
Upgrade Node.js to version 18 or later, or use v2.x for older Node versions.
affects: >=3.0.0
breakingUnderlying del package was upgraded with breaking changes in glob engine and options
fix
Review del changelog for version 5.0.0 and adjust your glob patterns/options accordingly.
affects: >=2.0.0 <3.0.0
deprecatedSupport for Node.js 8 dropped in v2.0.0
fix
Use Node.js 10+ or stay on v1.x.
affects: >=2.0.0
gotchaDefault hook is 'buildStart' - files are deleted at the start of the build, not the end
fix
If you need deletion after bundle, set hook: 'buildEnd' or 'writeBundle'.
affects: *
gotchaUsing wildcard * in targets may cause confusion with dotfiles
fix
Explicitly include dotfiles patterns (e.g., '**/.*') if you intend to delete hidden files.
affects: *
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module ... from ... not supported.
Importing the package with require() in a CommonJS environment, but v3+ is ESM-only.
fix
Use import del from 'rollup-plugin-delete' and ensure your project is ESM ("type": "module" in package.json), or downgrade to v2.x.
TypeError: del is not a function
The default export is a factory function; importing the named export incorrectly or using a wrong import style.
fix
Use default import: import del from 'rollup-plugin-delete'
Error: Cannot find module 'rollup-plugin-delete'
Package not installed or not listed in dependencies.
fix
Run npm install rollup-plugin-delete --save-dev (or yarn/pnpm equivalent).
Upgrade
Version history
3.0.2latest on npm
Audit
Dependencies
rolluprequiredpeer dependency - required to function as a Rollup plugin
delrequiredruntime dependency - provides core file deletion functionality
Agent activity
7 hits · last 30 days
node
6
Resources
rollup-plugin-delete — npm install rollup-plugin-delete · libregistry