diff --git a/webpack/production.js b/webpack/production.js index c90decd4e..dc9954ff3 100644 --- a/webpack/production.js +++ b/webpack/production.js @@ -89,32 +89,33 @@ module.exports = merge(sharedConfig, { minify: true, }, cacheMaps: [{ - match: requestUrl => { + // NOTE: This function gets stringified by OfflinePlugin, so don't try + // moving it anywhere else or making it depend on anything outside it! + match: ({ pathname }) => { const backendRoutes = [ + '/.well-known', + '/admin', '/api', - '/pleroma', - '/nodeinfo', - '/socket', - '/oauth', - '/.well-known/webfinger', - '/static', '/instance', '/main/ostatus', + '/manifest.json', + '/media', + '/nodeinfo', + '/oauth', '/ostatus_subscribe', '/pghero', + '/pleroma', '/sidekiq', - '/open-source', + '/socket', + '/static', + '/unsubscribe', ]; - const isBackendRoute = ({ pathname }) => { - if (pathname) { - return backendRoutes.some(pathname.startsWith); - } else { - return false; - } - }; - - return isBackendRoute(requestUrl) && requestUrl; + if (pathname) { + return backendRoutes.some(p => pathname.startsWith(p)); + } else { + return false; + } }, requestTypes: ['navigate'], }],