Last active
January 11, 2020 07:15
-
-
Save julianrubisch/b5f11f1dee4d6711b367a4ff0722f5f0 to your computer and use it in GitHub Desktop.
workbox webpack runtime cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new WorkboxWebpackPlugin.GenerateSW({ | |
clientsClaim: true, | |
exclude: [/\.map$/, /asset-manifest\.json$/], | |
importWorkboxFrom: "cdn", | |
runtimeCaching: [ | |
{ | |
urlPattern: new RegExp("https://images\.ctfassets\.net"), | |
handler: "cacheFirst" | |
}, | |
{ | |
urlPattern: new RegExp("https://cdn\.contentful\.com"), | |
handler: "cacheFirst" | |
}, | |
{ | |
urlPattern: new RegExp("http://video\.ctfassets\.net"), | |
handler: "cacheFirst" | |
} | |
], | |
navigateFallback: publicUrl + "/index.html", | |
navigateFallbackBlacklist: [ | |
// Exclude URLs starting with /_, as they're likely an API call | |
new RegExp("^/_") | |
// Exclude URLs containing a dot, as they're likely a resource in | |
// public/ and not a SPA route | |
// new RegExp("/[^/]+\\.[^/]+$") | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment