not precaching so aggressively

using runtime caching instead using a stale while revalidate strategy
caching webfonts with cache first since they will very rarely change
This commit is contained in:
Miodec 2022-11-03 15:31:37 +01:00
parent de1009fc07
commit 3667e7630b

View file

@ -87,6 +87,43 @@ const PRODUCTION_CONFIG = {
/\.DS_Store/,
/\.map$/,
/^manifest.*\.js$/,
/languages\/.*\.json/,
/quotes\/.*\.json/,
/themes\/.*\.css/,
/challenges\/.*\.txt/,
/sound\/.*\.wav/,
/images\/.*\.(png|jpg)/,
/webfonts\/.+/,
],
runtimeCaching: [
{
urlPattern: /languages\/.*\.json/,
handler: "StaleWhileRevalidate",
},
{
urlPattern: /quotes\/.*\.json/,
handler: "StaleWhileRevalidate",
},
{
urlPattern: /themes\/.*\.css/,
handler: "StaleWhileRevalidate",
},
{
urlPattern: /challenges\/.*\.txt/,
handler: "StaleWhileRevalidate",
},
{
urlPattern: /sound\/.*\.wav/,
handler: "StaleWhileRevalidate",
},
{
urlPattern: /images\/.*\.(png|jpg)/,
handler: "StaleWhileRevalidate",
},
{
urlPattern: /webfonts\/.+/,
handler: "CacheFirst",
},
],
}),
],