1. rollup-plugin-delete
Delete files and folders using Rollup
rollup-plugin-delete
Package: rollup-plugin-delete
Created by: vladshcherbin
Last modified: Mon, 16 May 2022 04:19:57 GMT
Version: 2.0.0
License: MIT
Downloads: 346,785
Repository: https://github.com/vladshcherbin/rollup-plugin-delete

Install

npm install rollup-plugin-delete
yarn add rollup-plugin-delete

rollup-plugin-delete

Build Status
Codecov

Delete files and folders using Rollup.

About

This plugin is useful when you want to clean dist or other folders and files before bundling. It's using del package inside, check it for pattern examples.

Installation

 # yarn
yarn add rollup-plugin-delete -D

# npm
npm install rollup-plugin-delete -D

Usage

 // rollup.config.js
import del from 'rollup-plugin-delete'

export default {
  input: 'src/index.js',
  output: {
    file: 'dist/app.js',
    format: 'cjs'
  },
  plugins: [
    del({ targets: 'dist/*' })
  ]
}

Configuration

There are some useful options:

targets

A string or an array of patterns of files and folders to be deleted. Default is [].

 del({
  targets: 'dist/*'
})

del({
  targets: ['dist/*', 'build/*']
})

verbose

Output removed files and folders to console. Default is false.

 del({
  targets: 'dist/*',
  verbose: true
})

Note: use * (wildcard character) in pattern to show removed files

hook

Rollup hook the plugin should use. Default is buildStart.

 del({
  targets: 'dist/*',
  hook: 'buildEnd'
})

runOnce

Type: boolean | Default: false

Delete items once. Useful in watch mode.

 del({
  targets: 'dist/*',
  runOnce: true
})

All other options are passed to del package which is used inside.

License

MIT

Dependencies

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code