summaryrefslogtreecommitdiff
path: root/webpack.parts.js
diff options
context:
space:
mode:
authormokha <mokha@cisco.com>2018-09-29 09:52:31 -0600
committermokha <mokha@cisco.com>2018-09-29 09:52:31 -0600
commita6235c463c6b6ac42bcf4ae6568be0687a59538d (patch)
tree725a793abdfffacd1bbe5d0f10b2aec74fad2bde /webpack.parts.js
parentfb63e5f976598dd23c0007497c201bd3f194c2ba (diff)
clean the target dir before building
Diffstat (limited to 'webpack.parts.js')
-rw-r--r--webpack.parts.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/webpack.parts.js b/webpack.parts.js
index 347421d..8e19318 100644
--- a/webpack.parts.js
+++ b/webpack.parts.js
@@ -1,5 +1,6 @@
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const PurifyCSSPlugin = require('purifycss-webpack');
+const CleanWebpackPlugin = require('clean-webpack-plugin');
exports.extractCSS = ({ include, exclude, use = [] }) => {
const plugin = new MiniCssExtractPlugin({
@@ -93,3 +94,7 @@ exports.loadJavaScript = ({ include, exclude } = {}) => (
exports.generateSourceMaps = ({ type }) => ({
devtool: type,
});
+
+exports.clean = path => ({
+ plugins: [new CleanWebpackPlugin([path])],
+});