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

Queston: How can I precache a page at /app? #262

Open
VelinGeorgiev opened this issue Oct 11, 2020 · 3 comments
Open

Queston: How can I precache a page at /app? #262

VelinGeorgiev opened this issue Oct 11, 2020 · 3 comments

Comments

@VelinGeorgiev
Copy link

VelinGeorgiev commented Oct 11, 2020

next-offline is a great project and thanks for making our lives so easy!

I am not familiar with the workbook setups, but I am trying to precache additional page at url /app that is to be used by my PWA as homepage instead of /. Is there a way for me to set a precache action it in the next-offline config?

My current setup is pretty basic, but I'd like to also include precache URL /app

 workboxOpts: {
        swDest: 'static/service-worker.js',
        runtimeCaching: [
            {
                urlPattern: /^https?.*/,
                handler: 'NetworkFirst',
                options: {
                    cacheName: 'https-calls',
                    networkTimeoutSeconds: 8,
                    expiration: {
                        maxEntries: 100,
                        maxAgeSeconds: 30 * 24 * 60 * 60 * 2, // 2 months
                    },
                    cacheableResponse: {
                        statuses: [0, 200],
                    },
                },
            },
        ],
    },

I've spend some time on Google before asking this question here, but seems I cannot find the right keywords to get it done.

Thank you!

@j3ski-passion
Copy link

@VelinGeorgiev
If you are using next-offline@5 you can use the additionalManifestEntries workbox option

@VelinGeorgiev
Copy link
Author

Thanks @j3ski-passion ! I will give it a try

@kaaax0815
Copy link

@j3ski-passion @VelinGeorgiev Do you have an example? I dont know how to make this work.

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

3 participants