Skip to content

A platform for community discussion. Free, open, simple.

DEV: Cachebust workbox assets (#23383)

David Taylorf645706e6ed7
diff --git a/app/assets/javascripts/discourse/lib/workbox-tree-builder.js b/app/assets/javascripts/discourse/lib/workbox-tree-builder.js
index e5686ad1ee5..3babdfb90c0 100644
--- a/app/assets/javascripts/discourse/lib/workbox-tree-builder.js
+++ b/app/assets/javascripts/discourse/lib/workbox-tree-builder.js
@@ -2,6 +2,10 @@ const crypto = require("crypto");
const mergeTrees = require("broccoli-merge-trees");
const funnel = require("broccoli-funnel");
+// Bump to cache-bust if there are any changes to the workbox compilation logic
+// which are not caused by a simple workbox version bump
+const COMPILER_VERSION = 2;
+
module.exports = function generateWorkboxTree() {
const workboxDeps = [
"workbox-sw",
@@ -25,7 +29,7 @@ module.exports = function generateWorkboxTree() {
// Sprockets' default behaviour for these files is disabled via freedom_patches/sprockets.rb.
const versionHash = crypto
.createHash("md5")
- .update(versions.join("|"))
+ .update(`${versions.join("|")}|${COMPILER_VERSION}`)
.digest("hex");
return funnel(mergeTrees(nodes), {