Can I exclude some urls while using sw precache for generating service worker.Below is my swprecache.config.json
module.exports = {
navigateFallback: '/index.html',
stripPrefix: 'dist',
root: 'dist/',
staticFileGlobs: [
'dist/index.html',
'dist/**.js',
'dist/**.css',
'dist/**.ico',
'dist/assets/images/**.jpg',
'dist/assets/images/**.png',
'dist/assets/images/**.gif',
'dist/assets/js/**/**.js',
'dist/assets/js/**.js',
'dist/assets/css/**.css',
'dist/assets/fonts/**.{js,html,css,png,jpg,gif,svg,eot,ttf,woff,ico}',
'dist/**.{js,html,css,png,jpg,gif,svg,eot,ttf,woff,ico}',
'!dist/Subscription/**.{js,html,css,png,jpg,gif,svg,eot,ttf,woff,ico}'
],
runtimeCaching: [{
urlPattern: /^https:\/\/netdna\.bootstrapcdn\.com\//,
handler: 'networkFirst'
}]
};
I tried to use not operator like '!dist/Subscription/**.{js,html,css,png,jpg,gif,svg,eot,ttf,woff,ico}'.But its not working.So that I am getting cannot match any route error while navigating to subsite.After clearing browser data only, I can navigate to subsite. Can anyone pls help me to fix it,pls find my error
Thanks
this should work:
staticFileGlobs: [
'dist/index.html',
'dist/*.{js,css,ico}',
'dist/!(Subscription)/**/*.{js,html,css,png,jpg,gif,svg,eot,ttf,woff,ico}'
]
found here: https://github.com/GoogleChromeLabs/sw-precache/issues/97
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With