@@ -12,14 +12,81 @@ export default withPwa(defineConfig({
1212 zh : { label : '简体中文' , ...zh }
1313 } ,
1414 pwa : {
15- // outDir: resolve(__dirname, '../', 'dist'),
16- // registerType: 'autoUpdate',
17- // srcDir: '.vitepress/',
18- strategies : 'generateSW' , // <== if omitted, defaults to `generateSW`
15+ outDir : resolve ( __dirname , '../dist' ) ,
16+ registerType : 'prompt' ,
17+ includeManifestIcons : false ,
18+ selfDestroying : true ,
19+ manifest : {
20+ id : '/' ,
21+ name : 'VueHooks plus' ,
22+ short_name : 'VueHooks plus' ,
23+ description : 'Highly customizable hooks for Vue' ,
24+ theme_color : '#ffffff' ,
25+ icons : [
26+ {
27+ src : 'logo.png' ,
28+ sizes : '192x192' ,
29+ type : 'image/png' ,
30+ } ,
31+ {
32+ src : 'logo@2.x.png' ,
33+ sizes : '512x512' ,
34+ type : 'image/png' ,
35+ } ,
36+ {
37+ src : 'logo.svg' ,
38+ sizes : '155x155' ,
39+ type : 'image/svg' ,
40+ purpose : 'any maskable' ,
41+ } ,
42+ ] ,
43+ } ,
1944 workbox : {
45+ globPatterns : [ '**/*.{css,js,html,svg,png,ico,txt,woff2}' ] ,
46+ runtimeCaching : [
47+ {
48+ urlPattern : / ^ h t t p s : \/ \/ f o n t s \. g o o g l e a p i s \. c o m \/ .* / i,
49+ handler : 'CacheFirst' ,
50+ options : {
51+ cacheName : 'google-fonts-cache' ,
52+ expiration : {
53+ maxEntries : 10 ,
54+ maxAgeSeconds : 60 * 60 * 24 * 365 , // <== 365 days
55+ } ,
56+ cacheableResponse : {
57+ statuses : [ 0 , 200 ] ,
58+ } ,
59+ } ,
60+ } ,
61+ {
62+ urlPattern : / ^ h t t p s : \/ \/ f o n t s \. g s t a t i c \. c o m \/ .* / i,
63+ handler : 'CacheFirst' ,
64+ options : {
65+ cacheName : 'gstatic-fonts-cache' ,
66+ expiration : {
67+ maxEntries : 10 ,
68+ maxAgeSeconds : 60 * 60 * 24 * 365 , // <== 365 days
69+ } ,
70+ cacheableResponse : {
71+ statuses : [ 0 , 200 ] ,
72+ } ,
73+ } ,
74+ } ,
75+ {
76+ urlPattern : / ^ h t t p s : \/ \/ c d n \. j s d e l i v r \. n e t \/ .* / i,
77+ handler : 'NetworkFirst' ,
78+ options : {
79+ cacheName : 'jsdelivr-images-cache' ,
80+ expiration : {
81+ maxEntries : 10 ,
82+ maxAgeSeconds : 60 * 60 * 24 * 7 , // <== 7 days
83+ } ,
84+ cacheableResponse : {
85+ statuses : [ 0 , 200 ] ,
86+ } ,
87+ } ,
88+ } ,
89+ ] ,
2090 } ,
21- experimental : {
22- includeAllowlist : true
23- }
2491 }
2592} ) )
0 commit comments