Преглед изворни кода

Merge branch 'iteration-large-version' into jenkins

lex пре 1 година
родитељ
комит
212176313f
1 измењених фајлова са 11 додато и 2 уклоњено
  1. 11 2
      dev-dist/sw.js

+ 11 - 2
dev-dist/sw.js

@@ -69,7 +69,7 @@ if (!self.define) {
   };
 }
 define(['./workbox-5357ef54'], function (workbox) {
-  'use strict';
+  ('use strict');
 
   self.skipWaiting();
   workbox.clientsClaim();
@@ -92,10 +92,19 @@ define(['./workbox-5357ef54'], function (workbox) {
     ],
     {}
   );
+  /**
+   * https://juejin.cn/post/6844903881189621767
+   * 缓存策略 有5种
+   */
   workbox.cleanupOutdatedCaches();
   workbox.registerRoute(
     new workbox.NavigationRoute(workbox.createHandlerBoundToURL('index.html'), {
       allowlist: [/^\/$/]
-    })
+    }),
+    workbox.strategies.NetworkFirst()
+  );
+  workbox.routing.registerRoute(
+    new RegExp('.*.html|css|js'),
+    workbox.strategies.NetworkFirst()
   );
 });