mo 1 year ago
parent
commit
71076e9f9b
1 changed files with 25 additions and 25 deletions
  1. 25 25
      vite.config.ts

+ 25 - 25
vite.config.ts

@@ -62,31 +62,31 @@ export default defineConfig({
     VitePWA({
       registerType: 'autoUpdate',
       includeAssets: ['./logo.png'],
-      // workbox: {
-      //   runtimeCaching: [
-      //     {
-      //       urlPattern: /(.*?)\.(js|css|ts|tsx|html)/, // js /css /ts静态资源缓存
-      //       handler: 'NetworkOnly',
-      //       options: {
-      //         cacheName: 'js-css-cache'
-      //       }
-      //     },
-      //     {
-      //       urlPattern: /.*\.html.*/,
-      //       handler: 'NetworkOnly',
-      //       options: {
-      //         cacheName: 'wisbayar-html',
-      //         expiration: {
-      //           maxEntries: 20,
-      //           maxAgeSeconds: 30 * 24 * 60 * 60
-      //         },
-      //         cacheableResponse: {
-      //           statuses: [200]
-      //         }
-      //       }
-      //     }
-      //   ]
-      // },
+      workbox: {
+        runtimeCaching: [
+          {
+            urlPattern: /(.*?)\.(js|css|ts|tsx|html)/, // js /css /ts静态资源缓存
+            handler: 'NetworkOnly',
+            options: {
+              cacheName: 'js-css-cache'
+            }
+          },
+          {
+            urlPattern: /.*\.html.*/,
+            handler: 'NetworkOnly',
+            options: {
+              cacheName: 'wisbayar-html',
+              expiration: {
+                maxEntries: 20,
+                maxAgeSeconds: 30 * 24 * 60 * 60
+              },
+              cacheableResponse: {
+                statuses: [200]
+              }
+            }
+          }
+        ]
+      },
       manifest: {
         name: '酷乐秀-音乐数字课堂',
         short_name: '音乐数字课堂',