NekR / offline-plugin

Offline plugin (ServiceWorker, AppCache) for webpack (https://webpack.js.org/)
MIT License
4.52k stars 295 forks source link

offline-plugin does not serve assets from service worker #496

Open sobition opened 3 years ago

sobition commented 3 years ago

Hi

I am using offline-plugin package to develop my PWA from a React source code. So far I managed to config the plugin to cache the assets in cache storage, but the problem is that when I open the app without internet connection it won't serve the assets from cache-storage. I can not find out what I am missing in the config. here is my offline-plugin config in webpack

‍‍‍‍‍‍new OfflinePlugin({ relativePaths: true, // publicPath: 'static-files/', excludes: [".htaccess"], caches: { main: [":rest:"], optional: [], }, AppCache: { caches: ["main", "additional", "optional"], FALLBACK: { "/": "static-files/fallback.html" }, }, appShell: "/", safeToUseOptionalCaches: true, responseStrategy: "cache-first", autoUpdate: true, ServiceWorker: { navigateFallbackURL: "/", publicPath: "/sw.js", output: "sw.js", events: true, prefetchRequest: { credentials: "include", mode: "cors", }, }, }),