Merge branch 'sw-backend-routes' into 'develop'

ServiceWorker: don't redirect API routes with appShell

See merge request soapbox-pub/soapbox-fe!810
merge-requests/811/head
Alex Gleason 2021-10-21 03:23:35 +00:00
commit 31c2f42cad
1 zmienionych plików z 26 dodań i 1 usunięć

Wyświetl plik

@ -81,10 +81,35 @@ module.exports = merge(sharedConfig, {
'packs/emoji/**/*',
],
ServiceWorker: {
cacheName: 'soapbox',
// entry: join(__dirname, '../app/soapbox/service_worker/entry.js'),
// cacheName: 'soapbox',
minify: true,
},
cacheMaps: [{
match: requestUrl => {
const backendRoutes = [
'/api',
'/pleroma',
'/nodeinfo',
'/socket',
'/oauth',
'/auth/password',
'/.well-known/webfinger',
'/static',
'/main/ostatus',
'/ostatus_subscribe',
'/pghero',
'/sidekiq',
];
const isBackendRoute = ({ pathname }) => {
return backendRoutes.some(pathname.startsWith);
};
return isBackendRoute(requestUrl) && requestUrl;
},
requestTypes: ['navigate'],
}],
safeToUseOptionalCaches: true,
appShell: join(FE_SUBDIRECTORY, '/'),
}),