From 953d3a4dc2f624c594d1946850ee14c58ffdd5f2 Mon Sep 17 00:00:00 2001 From: Tom Kirkpatrick Date: Tue, 24 Jul 2018 12:05:03 +0200 Subject: [PATCH] build(webpack): clean dist dir before builds Clean the dist dir before builds to remove stale/unwanted build results --- package.json | 1 + webpack.config.renderer.prod.js | 3 +++ yarn.lock | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/package.json b/package.json index d78d5f5e..fc8fd393 100644 --- a/package.json +++ b/package.json @@ -168,6 +168,7 @@ "babel-register": "^6.26.0", "browserslist": "^4.0.0", "chalk": "^2.4.1", + "clean-webpack-plugin": "^0.1.19", "concurrently": "^3.6.0", "connect-history-api-fallback": "^1.5.0", "cross-env": "^5.2.0", diff --git a/webpack.config.renderer.prod.js b/webpack.config.renderer.prod.js index 8ff0ad61..96b0bcba 100644 --- a/webpack.config.renderer.prod.js +++ b/webpack.config.renderer.prod.js @@ -7,6 +7,7 @@ import ExtractTextPlugin from 'extract-text-webpack-plugin' import HtmlWebpackPlugin from 'html-webpack-plugin' import CspHtmlWebpackPlugin from 'csp-html-webpack-plugin' import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer' +import CleanWebpackPlugin from 'clean-webpack-plugin' import merge from 'webpack-merge' import baseConfig from './webpack.config.base' @@ -141,6 +142,8 @@ export default merge.smart(baseConfig, { }, plugins: [ + new CleanWebpackPlugin(['app/dist']), + new ExtractTextPlugin('style.css'), new BundleAnalyzerPlugin({ diff --git a/yarn.lock b/yarn.lock index 26908bf2..eb928b3a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2722,6 +2722,12 @@ clean-css@4.1.x: dependencies: source-map "0.5.x" +clean-webpack-plugin@^0.1.19: + version "0.1.19" + resolved "https://registry.yarnpkg.com/clean-webpack-plugin/-/clean-webpack-plugin-0.1.19.tgz#ceda8bb96b00fe168e9b080272960d20fdcadd6d" + dependencies: + rimraf "^2.6.1" + cli-boxes@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-1.0.0.tgz#4fa917c3e59c94a004cd61f8ee509da651687143"