plugins.push(
new WorkboxWebpackPlugin.GenerateSW({
exclude: [
/\.html$/,
// /\/config-env\.js$|\/config\.js$/,
/\/public\,
/^(manifest|package|config-env|config|map).*\.js(?:on)?$/,
],
maximumFileSizeToCacheInBytes: 9 * 1024 * 1024,
clientsClaim: true,
// skipWaiting: true,
disableDevLogs: true,
cleanupOutdatedCaches: true,
runtimeCaching: [
{
urlPattern: /\.(png|jpg|jpeg|svg|gif)$/,
handler: "CacheFirst",
options: {
cacheName: "my-images-cache",
expiration: {
maxAgeSeconds: 7 * 24 * 60 * 60, // Cache images for 7 days
},
},
},
{
urlPattern: /\.css$/,
handler: "StaleWhileRevalidate",
options: {
cacheName: "my-css-cache",
expiration: {
maxAgeSeconds: 7 * 24 * 60 * 60, // Cache images for 7 days
},
},
},
{
urlPattern: /\.js$/, // Match all URLs
handler: "NetworkFirst",
options: {
cacheName: "my-js-cache",
expiration: {
maxAgeSeconds: 7 * 24 * 60 * 60, // Cache images for 7 days
},
},
},
],
})
I don't want to cache the public folder because there are some JS files and CSS files which is not currently minified so I don't want to reveal those in the browser cache. I have a separate folder called minified where I put all minified files(js, css) when I create the build.
And it's also storing the package.json files.
And i also not able to see the my-js-cache in cache folder in browser same thing my-css-cache and my-images-cache
I already used the exclude property in generateSW but files still stores in the browser cache