From 3e752c110f3e5c2927ec1483469ea9234772f00d Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Tue, 17 Sep 2024 09:26:15 +0800 Subject: [PATCH] Enable navigation preload --- package-lock.json | 1 + package.json | 1 + public/sw.js | 3 +++ 3 files changed, 5 insertions(+) diff --git a/package-lock.json b/package-lock.json index db71e800..9c96cfed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -66,6 +66,7 @@ "vite-plugin-run": "~0.5.2", "workbox-cacheable-response": "~7.1.0", "workbox-expiration": "~7.1.0", + "workbox-navigation-preload": "~7.1.0", "workbox-routing": "~7.1.0", "workbox-strategies": "~7.1.0" } diff --git a/package.json b/package.json index 27ec7562..07f8c99a 100644 --- a/package.json +++ b/package.json @@ -74,6 +74,7 @@ "vite-plugin-run": "~0.5.2", "workbox-cacheable-response": "~7.1.0", "workbox-expiration": "~7.1.0", + "workbox-navigation-preload": "~7.1.0", "workbox-routing": "~7.1.0", "workbox-strategies": "~7.1.0" }, diff --git a/public/sw.js b/public/sw.js index 34ddfb89..b2ad5f54 100644 --- a/public/sw.js +++ b/public/sw.js @@ -1,5 +1,6 @@ import { CacheableResponsePlugin } from 'workbox-cacheable-response'; import { ExpirationPlugin } from 'workbox-expiration'; +import * as navigationPreload from 'workbox-navigation-preload'; import { RegExpRoute, registerRoute, Route } from 'workbox-routing'; import { CacheFirst, @@ -7,6 +8,8 @@ import { StaleWhileRevalidate, } from 'workbox-strategies'; +navigationPreload.enable(); + self.__WB_DISABLE_DEV_LOGS = true; const assetsRoute = new Route(