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
This commit is contained in:
Martin Pitt 2022-04-21 14:21:12 +02:00 committed by Martin Pitt
parent a937b82cd2
commit 3aff8acad1

View file

@ -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,