Registry / devops / rollup-plugin-rm

rollup-plugin-rm

JSON →
library1.0.2jsnpmunverified

A Rollup plugin that executes the rm (remove) command during build hooks, specifically buildStart or buildEnd. Version 1.0.2 (current stable) has a low release cadence. It is a minimal alternative to rollup-plugin-delete or rollup-plugin-clean, offering no-config deletion via a simple string path argument. It ships TypeScript types and requires Rollup 3 or 4 as a peer dependency. Unlike alternatives, it does not support glob patterns or multiple directories—only a single path removal.

npm install rollup-plugin-rm
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-RM
R
rollup-plugin-rm
devopsjavascriptv1.0.2
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–223 runs
build_error
glibc
node 18–223 runs
build_error
Code
Verified usage

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

default
✓ import rm from 'rollup-plugin-rm'
✗ const rm = require('rollup-plugin-rm')
Plugin is ESM-only; require() will fail. Use dynamic import() if needed in CJS context.
rm
✓ import rm from 'rollup-plugin-rm'
✗ import { rm } from 'rollup-plugin-rm'
Library exports a default export, not a named export. Named import will yield undefined.
RollupPluginRmOptions
✓ import type { RollupPluginRmOptions } from 'rollup-plugin-rm'
✗ import { RollupPluginRmOptions } from 'rollup-plugin-rm'
Type import only – no runtime value. Use import type for type checking.

Shows removal of 'dist' folder at buildStart and 'dist/types' at buildEnd using the Rollup plugin.

import rm from 'rollup-plugin-rm'; import { defineConfig } from 'rollup'; export default defineConfig({ input: 'src/index.js', output: { dir: 'output', format: 'cjs' }, plugins: [ rm('dist', 'buildStart'), rm('dist/types', 'buildEnd') ] });
Debug
Known issues
breakingOnly supports string path argument, not an array of paths or glob patterns. Multiple directories require multiple plugin calls.
fix
Use multiple rm() calls for each directory, or switch to rollup-plugin-delete for glob support.
affects: >=1.0.0
gotchaPlugin uses synchronous rimraf under the hood. It may block the build for large directories; consider using asynchronous alternatives if performance is critical.
fix
For large directories, remove synchronously via buildStart/buildEnd hooks manually using fs.promises.rm.
affects: >=1.0.0
deprecatedNo deprecation warnings yet. Keep an eye on future releases for possible switch to async deletion.
fix
Monitor GitHub releases for potential breaking changes.
affects: >=1.0.0
gotchaIf the path does not exist, rimraf fails silently? Ensure the directory exists or wrap in try/catch? Documentation does not specify behavior for non-existent paths.
fix
Check existence before calling rm plugin; the underlying rimraf version may throw on ENOENT.
affects: >=1.0.0
breakingRollup 3 or 4 is required as peer dependency. Older Rollup 2 is not supported and will cause runtime hook mismatches.
fix
Upgrade Rollup to version 3 or 4, or use rollup-plugin-delete which supports Rollup 2.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: rollup_plugin_rm_default is not a function
Using named import 'rm' instead of default import
fix
Use `import rm from 'rollup-plugin-rm'`
Error [ERR_REQUIRE_ESM]: require() of ES Module
Using require() in a CommonJS context for an ESM-only package
fix
Migrate to ESM ('type':'module' in package.json) or use dynamic import: `const rm = (await import('rollup-plugin-rm')).default`
Error: Cannot find module 'rollup' (or peer dependency missing)
Rollup not installed as a dependency
fix
Run `npm install rollup --save-dev`
rollup-plugin-rm: Path must be a string
Passing an array or undefined as the path argument
fix
Pass a single string path: `rm('dist', 'buildStart')`. Use multiple calls for multiple paths.
Upgrade
Version history
1.0.2latest on npm
Audit
Dependencies
rollupoptionalPeer dependency – plugin hooks require Rollup's plugin system
Agent activity
2 hits · last 30 days
node
2
Resources
rollup-plugin-rm — npm install rollup-plugin-rm · libregistry