This commit is contained in:
taskylizard 2023-10-31 01:03:37 +05:30
parent 4b7b027536
commit 64af6e3d25
No known key found for this signature in database
GPG key ID: 5CABA3D642DDC497
7 changed files with 121 additions and 13 deletions

View file

@ -1,10 +1,16 @@
import type { PwaOptions } from "@vite-pwa/vitepress";
import { meta } from "./constants";
import { resolve } from "pathe";
import fg from "fast-glob";
export const pwa = {
outDir: ".vitepress/dist",
registerType: "autoUpdate",
includeManifestIcons: false,
includeAssets: fg.sync("**/*.{png,webp,svg,gif,ico,txt}", {
cwd: resolve(__dirname, "../public"),
}),
manifest: {
id: "/",
name: meta.name,
@ -18,19 +24,20 @@ export const pwa = {
display: "standalone",
display_override: ["window-controls-overlay"],
categories: meta.keywords,
// TODO: replace with actual icons
icons: [
{
src: "pwa-64x64.png",
src: "test.png",
sizes: "64x64",
type: "image/png",
},
{
src: "pwa-192x192.png",
src: "test.png",
sizes: "192x192",
type: "image/png",
},
{
src: "pwa-512x512.png",
src: "test.png",
sizes: "512x512",
type: "image/png",
purpose: "any",
@ -55,6 +62,9 @@ export const pwa = {
},
workbox: {
globPatterns: ["**/*.{css,js,html,svg,png,ico,txt,woff2,json}"],
globIgnores: ["**/404.html"],
navigateFallback: null,
runtimeCaching: [
{
urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,
@ -86,4 +96,8 @@ export const pwa = {
},
],
},
devOptions: {
enabled: true,
suppressWarnings: false,
},
} satisfies PwaOptions;