A webpack plugin to clean your built directory before compiling.
It is a better alternative to clean-webpack-plugin
, because it supports files
ignoring.
To begin, you need install it.
npm i -D clean-built-webpack-plugin
Next, add plugin to your config, ex.:
// webpack.config.js
const CleanPlugin = require('clean-built-webpack-plugin');
const config = {
plugins: [
new CleanPlugin()
]
}
module.exports = config;
Name | Type | Default | Description |
---|---|---|---|
ignore |
string[] |
[] |
The array of files to ignore (see supported paterrns) |
verbose |
boolean |
false |
If true , writes logs to console (always enabled if dry or force is true ) |
dry |
boolean |
false |
If true , simulates the removing and see what would be deleted |
force |
boolean |
false |
If true , allows deleting files outside current working directory |
event |
'before' |
'after' |
'before' |
include |
string[] |
['*'] |
The array of files to remove (if not specified, remove all files excluding specified in ignore ) |