A webpack plugin to remove/clean your build folder(s) before building
npm install clean-webpack-plugin --save-dev
var CleanWebpackPlugin = require('clean-webpack-plugin');
module.exports = {
plugins: [
new CleanWebpackPlugin(['dist', 'build'], {
root: '/full/project/path',
verbose: true,
dry: false
})
]
}
new CleanWebpackPlugin(paths [, {options}])
An [array] of string paths to clean
['dist', 'build']
{
"root": "[location of webpack.config]", // An absolute path for the root.
"verbose": true, // Write logs to console.
"dry": false, // Do not delete anything, good for testing.
}