Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

index.html served from service worker cache #465

Open
jchapelle opened this issue Sep 20, 2019 · 3 comments
Open

index.html served from service worker cache #465

jchapelle opened this issue Sep 20, 2019 · 3 comments

Comments

@jchapelle
Copy link

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,
    })
@alexgleason
Copy link

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

Bromite Browser hates this: bromite/bromite#1294

@alexgleason
Copy link

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

@jchapelle
Copy link
Author

jchapelle commented Jul 23, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants