From 23e0d3f2ff4a15d8b804c28a915cec53ddaf16ab Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 9 Dec 2021 15:13:05 +0100 Subject: [PATCH] get notification badge icon url through import now we transpile the sw --- scripts/build-plugins/service-worker.js | 1 - src/platform/web/sw.js | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/build-plugins/service-worker.js b/scripts/build-plugins/service-worker.js index a6817278..bd7d29d0 100644 --- a/scripts/build-plugins/service-worker.js +++ b/scripts/build-plugins/service-worker.js @@ -115,7 +115,6 @@ function replaceCacheFilenamesInServiceWorker(swChunk, unhashedFilenames, assets swSource = replaceArrayInSource("UNHASHED_PRECACHED_ASSETS", unhashedPreCachedAssets); swSource = replaceArrayInSource("HASHED_PRECACHED_ASSETS", hashedPreCachedAssets); swSource = replaceArrayInSource("HASHED_CACHED_ON_REQUEST_ASSETS", hashedCachedOnRequestAssets); - swSource = replaceStringInSource("NOTIFICATION_BADGE_ICON", assets.find(a => a.name === "icon.png").fileName); return swSource; } diff --git a/src/platform/web/sw.js b/src/platform/web/sw.js index 3404275d..6b864444 100644 --- a/src/platform/web/sw.js +++ b/src/platform/web/sw.js @@ -15,10 +15,12 @@ See the License for the specific language governing permissions and limitations under the License. */ +import NOTIFICATION_BADGE_ICON from "./assets/icon.png?url"; +// replaced by the service worker build plugin const UNHASHED_PRECACHED_ASSETS = []; const HASHED_PRECACHED_ASSETS = []; const HASHED_CACHED_ON_REQUEST_ASSETS = []; -const NOTIFICATION_BADGE_ICON = "assets/icon.png"; + const unhashedCacheName = `hydrogen-assets-${HYDROGEN_GLOBAL_HASH}`; const hashedCacheName = `hydrogen-assets`; const mediaThumbnailCacheName = `hydrogen-media-thumbnails-v2`;