关于 clean-webpack-plugin3.x 的配置说明
// Simulate the removal of files
// 模拟删除文件 仅仅报告要删除的文件并不删除
// default: false
dry: true,
// Write Logs to Console
// (Always enabled when dry is true)
// 报告删除的文件
// default: false
verbose: true,
// Automatically remove all unused webpack assets on rebuild
// 重建的时候自动删除 webpack 没有使用的资源
// default: true
cleanStaleWebpackAssets: false,
// Do not allow removal of current webpack assets
// 不允许删除cleanOnceBeforeBuildPatterns 中的文件
// default: true
protectWebpackAssets: false,
// **WARNING**
//
// Notes for the below options:
//
// They are unsafe...so test initially with dry: true.
//
// Relative to webpack's output.path directory.
// If outside of webpack's output.path directory,
// use full path. path.join(process.cwd(), 'build/**/*')
//
// These options extend del's pattern matching API.
// See https://github.com/sindresorhus/del#patterns
// for pattern matching documentation
// Removes files once prior to Webpack compilation
// Not included in rebuilds (watch mode)
// 初始化的时候清理
// Use !negative patterns to exclude files
//
// default: ['**/*']
cleanOnceBeforeBuildPatterns: ['**/*', '!static-files*'],
cleanOnceBeforeBuildPatterns: [], // disables cleanOnceBeforeBuildPatterns
// Removes files after every build (including watch mode) that match this pattern.
// Used for files that are not created directly by Webpack.
//
// Use !negative patterns to exclude files
// 构建完成后清理
// default: []
cleanAfterEveryBuildPatterns: ['static*.*', '!static1.js'],
// Allow clean patterns outside of process.cwd()
//
// requires dry option to be explicitly set
//
// default: false
dangerouslyAllowCleanPatternsOutsideProject: true