{"id":21983,"library":"rollup-plugin-delete","title":"rollup-plugin-delete","description":"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).","status":"active","version":"3.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/vladshcherbin/rollup-plugin-delete","tags":["javascript","rollup","rollup-plugin","delete","clear","clean","remove","file","folder","typescript"],"install":[{"cmd":"npm install rollup-plugin-delete","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-delete","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-delete","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency - required to function as a Rollup plugin","package":"rollup","optional":false},{"reason":"runtime dependency - provides core file deletion functionality","package":"del","optional":false}],"imports":[{"note":"Default export is the plugin factory. The package is ESM-only since v3, requiring import syntax.","wrong":"const del = require('rollup-plugin-delete')","symbol":"del","correct":"import del from 'rollup-plugin-delete'"},{"note":"TypeScript users should import types with 'import type' to avoid runtime inclusion.","wrong":"import { DelOptions } from 'rollup-plugin-delete'","symbol":"DelOptions","correct":"import type { DelOptions } from 'rollup-plugin-delete'"},{"note":"Type alias for the plugin's configuration object; available since v3 with TypeScript rewrite.","wrong":"","symbol":"RollupPluginDeleteOptions","correct":"import type { RollupPluginDeleteOptions } from 'rollup-plugin-delete'"}],"quickstart":{"code":"// rollup.config.js\nimport del from 'rollup-plugin-delete';\n\nexport default {\n  input: 'src/index.js',\n  output: { file: 'dist/bundle.js' },\n  plugins: [\n    del({ targets: 'dist/*', verbose: true, runOnce: true })\n  ]\n};","lang":"javascript","description":"Shows basic usage: delete all files in 'dist' before bundle, with verbose output and runOnce to avoid re-deletion in watch mode."},"warnings":[{"fix":"Use import syntax instead of require(). If you must use CommonJS, stay on v2.x.","message":"Package converted to pure ESM in v3.0.0 - require() will throw an error","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Upgrade Node.js to version 18 or later, or use v2.x for older Node versions.","message":"Requires Node.js 18+ starting from v3.0.0","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Review del changelog for version 5.0.0 and adjust your glob patterns/options accordingly.","message":"Underlying del package was upgraded with breaking changes in glob engine and options","severity":"breaking","affected_versions":">=2.0.0 <3.0.0"},{"fix":"Use Node.js 10+ or stay on v1.x.","message":"Support for Node.js 8 dropped in v2.0.0","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"If you need deletion after bundle, set hook: 'buildEnd' or 'writeBundle'.","message":"Default hook is 'buildStart' - files are deleted at the start of the build, not the end","severity":"gotcha","affected_versions":"*"},{"fix":"Explicitly include dotfiles patterns (e.g., '**/.*') if you intend to delete hidden files.","message":"Using wildcard * in targets may cause confusion with dotfiles","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use import del from 'rollup-plugin-delete' and ensure your project is ESM (\"type\": \"module\" in package.json), or downgrade to v2.x.","cause":"Importing the package with require() in a CommonJS environment, but v3+ is ESM-only.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module ... from ... not supported."},{"fix":"Use default import: import del from 'rollup-plugin-delete'","cause":"The default export is a factory function; importing the named export incorrectly or using a wrong import style.","error":"TypeError: del is not a function"},{"fix":"Run npm install rollup-plugin-delete --save-dev (or yarn/pnpm equivalent).","cause":"Package not installed or not listed in dependencies.","error":"Error: Cannot find module 'rollup-plugin-delete'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}