inspired by webpack-cleanup-plugin,cleanup files before run or after done
add plugin in your webpack.config.js
var CleanupPlugin =moduleexports =entry:index:"./index.js"module:loaders:...output:path:'./dist'filename:'[name]-[hash:8].min.js'plugins:include: './dist/*.js'
this plugin will delete all .js files in dist directory before webpack bundle run everytime
- include: delete files include which match glob patterns
- exclude: delete all files exclude which match glob patterns, if include options is provide, then this option will be ignore
- when: should be