Skip to content

Commit 107c102

Browse files
Merge pull request #77 from WailanTirajoh/chore/pwa
chore(deps): change pwa package to vite-pwa nuxt
2 parents 0f8bc27 + 6b5230c commit 107c102

File tree

7 files changed

+61
-4
lines changed

7 files changed

+61
-4
lines changed

app.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
<script setup lang="ts">
2-
import { TwButton, TwDialog, TwFeather } from "vue3-tailwind";
2+
import { useToast, TwButton, TwDialog, TwFeather } from "vue3-tailwind";
3+
const { $pwa } = useNuxtApp();
4+
5+
const toast = useToast();
6+
onMounted(() => {
7+
if ($pwa && $pwa.offlineReady) {
8+
toast.success({
9+
message: "App ready to work offline",
10+
});
11+
}
12+
});
313
</script>
414
<template>
15+
<NuxtPwaManifest />
516
<NuxtLayout>
617
<TwDialog>
718
<template v-slot="{ isShown, dialog, confirm, reject }">

nuxt.config.ts

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,52 @@ export default defineNuxtConfig({
2323
modules: [
2424
"@pinia/nuxt",
2525
"@pinia-plugin-persistedstate/nuxt",
26-
"@kevinmarrec/nuxt-pwa",
26+
"@vite-pwa/nuxt",
2727
"@vueuse/nuxt",
2828
],
2929
pwa: {
30+
registerType: "autoUpdate",
31+
manifest: {
32+
name: "Nuxt 3 admin template",
33+
short_name: "Nuxt3 Admin",
34+
theme_color: "#ffffff",
35+
icons: [
36+
{
37+
src: "pwa-192x192.png",
38+
sizes: "192x192",
39+
type: "image/png",
40+
},
41+
{
42+
src: "pwa-512x512.png",
43+
sizes: "512x512",
44+
type: "image/png",
45+
},
46+
{
47+
src: "pwa-512x512.png",
48+
sizes: "512x512",
49+
type: "image/png",
50+
purpose: "any maskable",
51+
},
52+
],
53+
},
3054
workbox: {
31-
enabled: false,
55+
globPatterns: ["**/*.{js,css,html,png,svg,ico}"],
56+
},
57+
injectManifest: {
58+
globPatterns: ["**/*.{js,css,html,png,svg,ico}"],
59+
},
60+
client: {
61+
installPrompt: true,
62+
// you don't need to include this: only for testing purposes
63+
// if enabling periodic sync for update use 1 hour or so (periodicSyncForUpdates: 3600)
64+
periodicSyncForUpdates: 20,
65+
},
66+
devOptions: {
67+
enabled: true,
68+
suppressWarnings: true,
69+
navigateFallback: "/",
70+
navigateFallbackAllowlist: [/^\/$/],
71+
type: "module",
3272
},
3373
},
3474
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
"devDependencies": {
1111
"@commitlint/cli": "^19.2.1",
1212
"@commitlint/config-conventional": "^19.1.0",
13-
"@kevinmarrec/nuxt-pwa": "^0.17.0",
1413
"@pinia-plugin-persistedstate/nuxt": "^1.0.0",
1514
"@tailwindcss/typography": "^0.5.8",
1615
"@types/feather-icons": "^4.29.0",
1716
"@types/quill": "^2.0.9",
17+
"@vite-pwa/nuxt": "^0.9.1",
1818
"@vueuse/core": "^10.1.2",
1919
"@vueuse/nuxt": "^10.1.2",
2020
"autoprefixer": "^10.4.13",

public/pwa-192x192.png

14 KB
Loading
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[ZoneTransfer]
2+
ZoneId=3
3+
HostUrl=https://github.com/

public/pwa-512x512.png

50.1 KB
Loading
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[ZoneTransfer]
2+
ZoneId=3
3+
HostUrl=https://github.com/

0 commit comments

Comments
 (0)