NekR / offline-plugin

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

Cache does not respect query parameters #433

Open firasdib opened 5 years ago

firasdib commented 5 years ago

Hello,

My config currently looks like this:

    externals: ['/'],
    ServiceWorker: { scope: '/' },
    scope: '/',

Where my purpose was to cache the html file returned by the the server (SSR), and cache all the js files. This works great, however, if I try to visit /?query=param, I get my cached result back (i.e., it does not hit the server), which is incorrect.

Is there a way to make it only return a cached result in specific cases? Such as, when there are no query parameters. If there is a network error, it'd perhaps prefer my app-shell or something like that.

Thanks in advance.