From 1aa5a6ee21dc53979fb15da1fc5eeb2cf562b1ad Mon Sep 17 00:00:00 2001 From: LiuChangFreeman Date: Wed, 9 Feb 2022 00:18:08 +0800 Subject: [PATCH] add thumbnail cache in pwa --- config/webpack.config.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/config/webpack.config.js b/config/webpack.config.js index bf764421..6337e90e 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -668,6 +668,19 @@ module.exports = function(webpackEnv) { new RegExp(/^\/api/), new RegExp(/^\/custom/), ], + runtimeCaching: [ + { + urlPattern: new RegExp(/.*\/thumb\/.*/i), + handler: 'StaleWhileRevalidate', + options: { + cacheName: 'thumbnail-cache', + expiration: { + maxEntries: 100, + maxAgeSeconds: 30 * 24 * 60 * 60, + }, + }, + } + ] }), // TypeScript type checking useTypeScript &&