Enable navigation preload

This commit is contained in:
Lim Chee Aun 2024-09-17 09:26:15 +08:00
parent 2a80f876be
commit 3e752c110f
3 changed files with 5 additions and 0 deletions

1
package-lock.json generated
View file

@ -66,6 +66,7 @@
"vite-plugin-run": "~0.5.2", "vite-plugin-run": "~0.5.2",
"workbox-cacheable-response": "~7.1.0", "workbox-cacheable-response": "~7.1.0",
"workbox-expiration": "~7.1.0", "workbox-expiration": "~7.1.0",
"workbox-navigation-preload": "~7.1.0",
"workbox-routing": "~7.1.0", "workbox-routing": "~7.1.0",
"workbox-strategies": "~7.1.0" "workbox-strategies": "~7.1.0"
} }

View file

@ -74,6 +74,7 @@
"vite-plugin-run": "~0.5.2", "vite-plugin-run": "~0.5.2",
"workbox-cacheable-response": "~7.1.0", "workbox-cacheable-response": "~7.1.0",
"workbox-expiration": "~7.1.0", "workbox-expiration": "~7.1.0",
"workbox-navigation-preload": "~7.1.0",
"workbox-routing": "~7.1.0", "workbox-routing": "~7.1.0",
"workbox-strategies": "~7.1.0" "workbox-strategies": "~7.1.0"
}, },

View file

@ -1,5 +1,6 @@
import { CacheableResponsePlugin } from 'workbox-cacheable-response'; import { CacheableResponsePlugin } from 'workbox-cacheable-response';
import { ExpirationPlugin } from 'workbox-expiration'; import { ExpirationPlugin } from 'workbox-expiration';
import * as navigationPreload from 'workbox-navigation-preload';
import { RegExpRoute, registerRoute, Route } from 'workbox-routing'; import { RegExpRoute, registerRoute, Route } from 'workbox-routing';
import { import {
CacheFirst, CacheFirst,
@ -7,6 +8,8 @@ import {
StaleWhileRevalidate, StaleWhileRevalidate,
} from 'workbox-strategies'; } from 'workbox-strategies';
navigationPreload.enable();
self.__WB_DISABLE_DEV_LOGS = true; self.__WB_DISABLE_DEV_LOGS = true;
const assetsRoute = new Route( const assetsRoute = new Route(