Only cache *.js and *.css
Thanks for the great plugin. I'm using offline-plugin for a react app. It's an isomorphic app. My problem is, all my network calls are served from the serviceworker. Let me explain.
My config
new OfflinePlugin({
caches: {
main: [
'*.js',
'*.css',
'/offline',
],
},
autoUpdate: true,
version: () => { },
ServiceWorker: {
output: '../sw.js',
navigateFallbackURL: '/offline',
navigateFallbackForRedirects: false,
publicPath: '/sw.js',
minify: true,
prefetchRequest: {
credentials: 'same-origin',
},
},
AppCache: false,
}),
But when I do a request for /category or /login, the HTML is also being served from the cache. The problem is it's not giving the latest HTML. Attaching the network waterfall.

**Is there a way not to serve HTML from the serviceworker? or just serve .js and .css from the cache?
What I did (not sure if it's correct, but it works) was add some tests to ServiceWorker.navigationPreload.test. My usecase was that I didn't want files from a specific folder to be handled by the serviceworker, like videos.
ServiceWorker:{
navigationPreload: {
test: (url) => {
// return false if you don't want the sw to handle the traffic
}
}
}