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

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

Open
arackaf opened this issue Jul 25, 2017 · 0 comments
Open

Comments

@arackaf
Copy link

arackaf commented Jul 25, 2017

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.

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

No branches or pull requests

1 participant