Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

A misplaced successResponses value can create an invalid service worker #260

@arackaf

Description

@arackaf

First, can I ask if sw-precache will continue to be maintained? It appears as though

https://workboxjs.org/

is set up to replace this?


This configuration

        new SWPrecacheWebpackPlugin({
            runtimeCaching: [{
                urlPattern: /junk\/file1a\.js\?ver=.*/,
                handler: 'cacheFirst',
                options: {
                    cache: {
                        maxEntries: 1,
                        name: 'dist-resources'
                    },
                    successResponses: /200/,
                },
            }],

works fine, but, for those users unsure where to put successResponses (it doesn't seem to be documented), if they put it inside the cache object

        new SWPrecacheWebpackPlugin({
            runtimeCaching: [{
                urlPattern: /junk\/file1a\.js\?ver=.*/,
                handler: 'cacheFirst',
                options: {
                    cache: {
                        maxEntries: 1,
                        name: 'dist-resources',
                        successResponses: /200/,
                    },
                },
            }],

then the service worker gets generated with this

toolbox.router.get(/junk\/file1a\.js\?ver=.*/, toolbox.cacheFirst, {"cache":{"maxEntries":1,"name":"dist-resources","successResponses":{}}});

where successResponses.test will now of course be undefined.

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