From 3aff8acad1b198cba4119960405d69799a73ff40 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 21 Apr 2022 14:21:12 +0200 Subject: [PATCH] webpack: Always regenerate and clean up dist/ By default, webpack does not clean up dist/, so when you e.g. touch the code and rebuild with `NODE_ENV=devel`, the old compressed assets from a previous `production` build were left in place, and cockpit could serve the old wrong ones. Enable the `clean` output option to fix this [1]. Also force the rewrite of all files with `compareBeforeEmit: false`, so that the time stamps actually get updated on a webpack run. This fixes `make` rules and unnecessary rebuilds when nothing changed. Fixes #563 [1] https://webpack.js.org/configuration/output/#outputclean --- webpack.config.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/webpack.config.js b/webpack.config.js index 63e5dc6..0745388 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -63,6 +63,8 @@ module.exports = { externals: { "cockpit": "cockpit" }, devtool: "source-map", stats: "errors-warnings", + // always regenerate dist/, so make rules work + output: { clean: true, compareBeforeEmit: false }, optimization: { minimize: production,