igroot-builder
Version:
白山——zeus系统前端打包工具
21 lines (16 loc) • 441 B
JavaScript
const rm = require('rimraf')
const path = require('path')
function isAbsolute(dir) {
return path.normalize(dir + path.sep) === path.normalize(path.resolve(dir) + path.sep)
}
function CleanDirPlugin(paths) {
this.paths = paths
}
CleanDirPlugin.prototype.apply = function(compiler) {
this.paths.forEach(function(_path) {
rm.sync(isAbsolute(_path)
? _path
: path.resolve(_path))
})
}
module.exports = CleanDirPlugin