I'm making a React PWA which works fine on localhost to cache all the listed files but when I deploy the project on Netlify or any other platform it won't cache the files and is not working offline. The cache storage shows empty list which in case of localhost shows all the files I'm caching. The service worker file is being registered in both cases.

The link to my github repo is here: https://github.com/noumanmalik960/quiz-app-pwa
Here is service worker file code:
const CACHE_NAME = "cache-v1"
const urlsToCache = [
'/',
'/index.html',
'/static/js/bundle.js',
'/static/js/0.chunk.js',
'/static/js/main.chunk.js',
'/manifest.json',
'/static/media/bg.759ecf3a.jpg',
'/images/logo.png'
]
self.addEventListener('install', function (event) {
// Perform install steps
event.waitUntil(
caches.open(CACHE_NAME)
.then(function (cache) {
console.log('Opened cache');
return cache.addAll(urlsToCache);
})
);
});
self.addEventListener('fetch', function (event) {
if (!navigator.onLine) {
event.respondWith(
caches.match(event.request)
.then(function (response) {
if (response)
return response;
return fetch(event.request);
})
)
}
})

https://quiz-pwa-knowmi.netlify.app/", that is my netlify deployment link but the problem is still the same. - Nouman Javed