/del-webpack-plugin

remove/clean old files after webpack build

Primary LanguageJavaScriptMIT LicenseMIT

Del-webpack-plugin

This webpack plugin clean old files after build.
Just as the well-known plugin clean-webpack-plugin, and more than it.

feature

  • only delete after webpack compile
  • skip plugin if compile error
  • multiple entry / path support
  • include / exclude files support
  • verbose / mute info support
  • colorful log with chalk
  • example with webpack
  • support cross platform

install

// use npm
npm install -D del-webpack-plugin

// use yarn
yarn add -D del-webpack-plugin

usage (in your webpack config)

const DelWebpackPlugin = require('del-webpack-plugin')

{
  plugins: [
    new DelWebpackPlugin({
      info: true,
      exclude: ['test.js']
    })
  ]
}

options

options.info

console.log added files and deleted files

  • type: Boolean
  • default: true

options.include

a file list you wanna delete it will delete all files and folders by default

  • type: [String]
  • default: ['**']
  • example: ['trash.js', 'trash/*.js']

// only files not folders use ['**.*']

options.exclude

a file list you dont wanna delete

  • type: [String]
  • default: []
  • example: ['test.js', 'test/*.js']

Welcome any issues and PRs submit :D