Skip to content

How to use Workbox custom cache in nuxt3? #181

@bbhxwl

Description

@bbhxwl

The following code doesn't seem to work.
I want to cache my post request and set the cache time for this request through a certain parameter.

nuxt.config.ts

    pwa:{
        workbox:{
            enabled:true,
            runtimeCaching:[
                {
                    urlPattern: '.*',
                    handler: 'CacheFirst',
                    options:{
                        cacheName:"api-cache",
                        expiration: {
                            maxEntries: 10,
                            maxAgeSeconds: 60
                        },
                        cacheableResponse: {
                            statuses: [0, 200]
                        }
                    }
                }
            ]
        }
    },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions