aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modern/src/service-worker.js19
1 files changed, 14 insertions, 5 deletions
diff --git a/modern/src/service-worker.js b/modern/src/service-worker.js
index 0f1e0ce0..718ed766 100644
--- a/modern/src/service-worker.js
+++ b/modern/src/service-worker.js
@@ -28,19 +28,28 @@ const fileExtensionRegexp = new RegExp('/[^/?]+\\.[^/]+$');
registerRoute(
// Return false to exempt requests from being fulfilled by index.html.
({ request, url }) => {
+
// If this isn't a navigation, skip.
if (request.mode !== 'navigate') {
return false;
- } // If this is a URL that starts with /_, skip.
+ }
- if (url.pathname.startsWith('/_')) {
+ // If this is a URL that starts with /api/, skip.
+ if (url.pathname.startsWith('/api/')) {
return false;
- } // If this looks like a URL for a resource, because it contains // a file extension, skip.
+ }
+ // If this is a URL that starts with /_, skip.
+ if (url.pathname.startsWith('/_')) {
+ return false;
+ }
+
+ // If this looks like a URL for a resource, because it contains // a file extension, skip.
if (url.pathname.match(fileExtensionRegexp)) {
return false;
- } // Return true to signal that we want to use the handler.
-
+ }
+
+ // Return true to signal that we want to use the handler.
return true;
},
createHandlerBoundToURL(process.env.PUBLIC_URL + '/index.html')