adding clean webpack plugin to cleanup public folder on build

This commit is contained in:
Tieu-Philippe KHIM 2018-02-19 15:19:09 +01:00
parent b7db70c166
commit 73c5b61931
4 changed files with 21 additions and 0 deletions

View File

@ -819,6 +819,15 @@
"source-map": "0.5.7"
}
},
"clean-webpack-plugin": {
"version": "0.1.18",
"resolved": "https://registry.npmjs.org/clean-webpack-plugin/-/clean-webpack-plugin-0.1.18.tgz",
"integrity": "sha512-Kf1BxQnNy2Zq5TBIgWBTEHrhycOM1QjjBYOoTV5P7WioAPr/sh6fgPwn6xYvTIp3EP+yUqoOL4YFpLQVobeIUg==",
"dev": true,
"requires": {
"rimraf": "2.6.2"
}
},
"cliui": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz",

View File

@ -9,6 +9,7 @@
},
"devDependencies": {
"bower": "^1.8.0",
"clean-webpack-plugin": "^0.1.18",
"copy-webpack-plugin": "^4.4.1",
"css-loader": "^0.28.9",
"del": "^2.2.1",

View File

@ -2,6 +2,8 @@
const webpack = require("webpack");
const path = require("path");
const CleanWebpackPlugin = require("clean-webpack-plugin");
module.exports = {
entry: "./js/app.js",
output: {
@ -53,4 +55,7 @@ module.exports = {
},
],
},
plugins: [
new CleanWebpackPlugin("./public/*.*"),
]
};

View File

@ -525,6 +525,12 @@ clean-css@4.1.x:
dependencies:
source-map "0.5.x"
clean-webpack-plugin@^0.1.18:
version "0.1.18"
resolved "https://registry.yarnpkg.com/clean-webpack-plugin/-/clean-webpack-plugin-0.1.18.tgz#2e2173897c76646031bff047c14b9c22c80d8c4a"
dependencies:
rimraf "^2.6.1"
cliui@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1"