From f5d538ba4880cf8ed4e2bdfb9ff90017da81e93b Mon Sep 17 00:00:00 2001 From: Pranav Date: Sat, 10 Jan 2026 15:38:12 -0800 Subject: [PATCH] fix: Use bare identifiers for Vite define replacement in service worker Vite's define option replaces identifiers, not string literals. Changed from '__CACHE_VERSION__' (string) to __CACHE_VERSION__ (identifier) so Vite can properly inject the values at build time. Co-Authored-By: Claude Opus 4.5 --- app/javascript/service-worker/sw-runtime.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/javascript/service-worker/sw-runtime.js b/app/javascript/service-worker/sw-runtime.js index 78f0c10eb..2e6270814 100644 --- a/app/javascript/service-worker/sw-runtime.js +++ b/app/javascript/service-worker/sw-runtime.js @@ -1,9 +1,9 @@ -/* eslint-disable no-restricted-globals, no-use-before-define */ +/* eslint-disable no-restricted-globals, no-use-before-define, no-undef */ -// Build-time injected values -const CACHE_VERSION = '__CACHE_VERSION__'; -const ASSET_ORIGIN = '__ASSET_ORIGIN__'; -const ASSET_MANIFEST = '__ASSET_MANIFEST__'; +// Build-time injected values (replaced by Vite define at build time) +const CACHE_VERSION = __CACHE_VERSION__; +const ASSET_ORIGIN = __ASSET_ORIGIN__; +const ASSET_MANIFEST = __ASSET_MANIFEST__; const CACHE_NAME = `chatwoot-${CACHE_VERSION}`;