get notification badge icon url through import now we transpile the sw

This commit is contained in:
Bruno Windels 2021-12-09 15:13:05 +01:00
parent a4fac68393
commit 23e0d3f2ff
2 changed files with 3 additions and 2 deletions

View file

@ -115,7 +115,6 @@ function replaceCacheFilenamesInServiceWorker(swChunk, unhashedFilenames, assets
swSource = replaceArrayInSource("UNHASHED_PRECACHED_ASSETS", unhashedPreCachedAssets); swSource = replaceArrayInSource("UNHASHED_PRECACHED_ASSETS", unhashedPreCachedAssets);
swSource = replaceArrayInSource("HASHED_PRECACHED_ASSETS", hashedPreCachedAssets); swSource = replaceArrayInSource("HASHED_PRECACHED_ASSETS", hashedPreCachedAssets);
swSource = replaceArrayInSource("HASHED_CACHED_ON_REQUEST_ASSETS", hashedCachedOnRequestAssets); swSource = replaceArrayInSource("HASHED_CACHED_ON_REQUEST_ASSETS", hashedCachedOnRequestAssets);
swSource = replaceStringInSource("NOTIFICATION_BADGE_ICON", assets.find(a => a.name === "icon.png").fileName);
return swSource; return swSource;
} }

View file

@ -15,10 +15,12 @@ See the License for the specific language governing permissions and
limitations under the License. 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 UNHASHED_PRECACHED_ASSETS = [];
const HASHED_PRECACHED_ASSETS = []; const HASHED_PRECACHED_ASSETS = [];
const HASHED_CACHED_ON_REQUEST_ASSETS = []; const HASHED_CACHED_ON_REQUEST_ASSETS = [];
const NOTIFICATION_BADGE_ICON = "assets/icon.png";
const unhashedCacheName = `hydrogen-assets-${HYDROGEN_GLOBAL_HASH}`; const unhashedCacheName = `hydrogen-assets-${HYDROGEN_GLOBAL_HASH}`;
const hashedCacheName = `hydrogen-assets`; const hashedCacheName = `hydrogen-assets`;
const mediaThumbnailCacheName = `hydrogen-media-thumbnails-v2`; const mediaThumbnailCacheName = `hydrogen-media-thumbnails-v2`;