offline-plugin icon indicating copy to clipboard operation
offline-plugin copied to clipboard

index.html served from service worker cache

Open jchapelle opened this issue 6 years ago • 3 comments

Hello, I'm using the reactboilerplate. Guys from the community encounter trouble with the caching of the spa. Can you help ?

The configuration is as below. I've just added the index.html file in the exclude list. However, the index.html file keeps being served by service worker after first load of the app. How can I disable the caching of index.html ?

    // Put it in the end to capture all the HtmlWebpackPlugin's
    // assets manipulations and do leak its manipulations to HtmlWebpackPlugin
    new OfflinePlugin({
      relativePaths: false,
      publicPath: '/',
      appShell: '/',

      // No need to cache .htaccess. See http://mxs.is/googmp,
      // this is applied before any match in `caches` section
      excludes: ['.htaccess', 'index.html'],

      caches: {
        main: [':rest:'],

        // All chunks marked as `additional`, loaded after main section
        // and do not prevent SW to install. Change to `optional` if
        // do not want them to be preloaded at all (cached only when first loaded)
        additional: ['*.chunk.js'],
      },

      // Removes warning for about `additional` section usage
      safeToUseOptionalCaches: true,
    })

jchapelle avatar Sep 20 '19 06:09 jchapelle

Did you ever solve this? I tried '/' and ''

Bromite Browser hates this: https://github.com/bromite/bromite/issues/1294

alexgleason avatar Jul 23 '21 01:07 alexgleason

Actually, excludes: ['index.html'] worked for me. I'm generating the index file with html-webpack-plugin

alexgleason avatar Jul 23 '21 02:07 alexgleason

I finally stopped using this package

On Fri, 23 Jul 2021 at 04:33, Alex Gleason @.***> wrote:

Actually, excludes: ['index.html'] worked for me. I'm generating the index file with html-webpack-plugin

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/NekR/offline-plugin/issues/465#issuecomment-885358955, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPAMXNQWVZLHVCQ4JZBRTDTZDII7ANCNFSM4IYTDC2Q .

-- Jean Chapelle

jchapelle avatar Jul 23 '21 06:07 jchapelle