{"id":22002,"library":"rollup-plugin-empty","title":"rollup-plugin-empty","description":"A Rollup plugin for emptying directories or deleting files before a build. Version 1.0.0, stable. Differentiates by supporting both directory emptying and file deletion via fast-glob patterns, silent mode option for logging control. Useful for cleaning output directories as part of the build pipeline.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/fengxinming/rollup-plugins/tree/master/packages/rollup-plugin-empty","tags":["javascript","rollup","rollup-plugin","empty"],"install":[{"cmd":"npm install rollup-plugin-empty","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-empty","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-empty","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Powering glob matching for file and directory patterns.","package":"fast-glob","optional":false}],"imports":[{"note":"Default export in ESM, named import does not exist.","wrong":"const { empty } = require('rollup-plugin-empty')","symbol":"default","correct":"import empty from 'rollup-plugin-empty'"},{"note":"CommonJS require, works in Node without issues.","wrong":null,"symbol":"default","correct":"const empty = require('rollup-plugin-empty')"},{"note":"TypeScript users can import the options interface for type checking.","symbol":"EmptyOptions","correct":"import type { EmptyOptions } from 'rollup-plugin-empty'"}],"quickstart":{"code":"import empty from 'rollup-plugin-empty';\n\nexport default {\n  input: 'src/index.js',\n  plugins: [\n    empty({\n      silent: false,\n      dir: 'dist'\n    })\n  ],\n  output: {\n    dir: 'dist',\n    format: 'es'\n  }\n};","lang":"javascript","description":"Demonstrates emptying the 'dist' directory before building with Rollup."},"warnings":[{"fix":"Use either `file` or `dir` exclusively, or carefully design patterns to avoid overlap.","message":"Using both `file` and `dir` options may lead to unintended behavior: files matching both patterns might be deleted and also the directory emptied.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Use absolute paths or ensure cwd is correct.","message":"Glob patterns are resolved relative to the current working directory, not the config file location.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Explicitly set 'silent' to desired value.","message":"Option 'silent' default changed from false to true in future versions; not yet deprecated but behavior may change.","severity":"deprecated","affected_versions":">=1.0 <2.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use `import empty from 'rollup-plugin-empty'`","cause":"Using named import instead of default import in ESM.","error":"TypeError: empty is not a function"},{"fix":"Ensure files exist at build start or use 'dir' option instead.","cause":"The file specified in 'file' option does not exist or already deleted.","error":"ENOENT: no such file or directory, unlink '...'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}