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

sw-precache-cra - How to exclude files #7

Open
DevJett opened this issue Jan 14, 2021 · 0 comments
Open

sw-precache-cra - How to exclude files #7

DevJett opened this issue Jan 14, 2021 · 0 comments

Comments

@DevJett
Copy link

DevJett commented Jan 14, 2021

Is it possible to ignore a file from caching?
I have a meta.json file including a version of the site and I want the service worker to ignore this file.

My attempt

module.exports = {
    staticFileGlobs: [
        'build/*.html',
        'build/manifest.json',
        'build/static/js/*.js',
        'build/static/css/*.css',
        'build/static/media/**',
    ],
    staticFileGlobsIgnorePatterns: [/\.map$/, /meta\.json$/],
    swFilePath: 'build/service-worker.js',
    stripPrefix: 'build/',
    runtimeCaching: [
        {
            urlPattern: /blog/,
            handler: 'networkFirst'
        }
    ]
}

It does not work.
Can anybody help?

@DevJett DevJett closed this as completed Jan 14, 2021
@DevJett DevJett reopened this Jan 15, 2021
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

1 participant