From 952dfa9d41ba0d26082121a57563a52fa4ab51dd Mon Sep 17 00:00:00 2001 From: Guillaume Briday Date: Sun, 7 Jan 2018 20:17:16 +0100 Subject: [PATCH] Adding clean-webpack-plugin --- package-lock.json | 9 +++++++++ package.json | 1 + webpack.config.js | 2 ++ 3 files changed, 12 insertions(+) diff --git a/package-lock.json b/package-lock.json index 61648e6..847e4a5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1847,6 +1847,15 @@ } } }, + "clean-webpack-plugin": { + "version": "0.1.17", + "resolved": "https://registry.npmjs.org/clean-webpack-plugin/-/clean-webpack-plugin-0.1.17.tgz", + "integrity": "sha512-Bts/V725v8Ijosp4K1cqppQXgXcrohxoMsg0CV2xL4y/vua1G5pAfHEW/eJIiKF+GNNG72mdjbipxMRFEms7yg==", + "dev": true, + "requires": { + "rimraf": "2.6.2" + } + }, "cli-boxes": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-1.0.0.tgz", diff --git a/package.json b/package.json index a39bcc2..d30099f 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "babel-preset-env": "^1.6.0", "babel-preset-es2015": "^6.24.1", "babel-preset-stage-3": "^6.24.1", + "clean-webpack-plugin": "^0.1.17", "cross-env": "^5.0.5", "css-loader": "^0.28.7", "eslint": "^4.14.0", diff --git a/webpack.config.js b/webpack.config.js index edf3ec3..18aba90 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -4,6 +4,7 @@ var webpack = require('webpack') var ExtractTextPlugin = require('extract-text-webpack-plugin') var PurifyCSSPlugin = require('purifycss-webpack') var HtmlWebpackPlugin = require('html-webpack-plugin') +var CleanWebpackPlugin = require('clean-webpack-plugin') var inProduction = (process.env.NODE_ENV === 'production') module.exports = { @@ -115,6 +116,7 @@ if (inProduction) { ]), minimize: true }), + new CleanWebpackPlugin(['dist']), new webpack.LoaderOptionsPlugin({ minimize: true }),