Hari Pachuveetil
Hari Pachuveetil

Reputation: 10374

Workbox: `ignoreUrlParametersMatching` seems to be not working

I am using workbox 4.0.0 and have a gulp task that uses injectManifest method of workbox-build - and the source/template file for service-worker (swSrc) has this block in it:

workbox.precaching.precacheAndRoute(
    [],
    {
        ignoreUrlParametersMatching: [/.*/]
    });

This is getting updated correctly to become the built service-worker (swDest) that looks like this:

workbox.precaching.precacheAndRoute([
  {
    "url": "style.css",
    "revision": "0ba0898e1a16d9f6eeec49041da47e79"
  },
  {
    "url": "script.js",
    "revision": "e8387f082ead450d27fa5c2865ad0eec"
  },
  // ...many more such files
],
    {
        ignoreUrlParametersMatching: [/.*/]
    });

But precaching does not match a request in this form: http://localhost:8080/style.css?v4.7.0

While debugging with breakpoints set within the addRoute method within workbox-precaching.dev.js, it looks like ignoreURLParametersMatching there still has the default value specified there: [/^utm_/]

EDIT: What is interesting is, the precacheAndRoute function that calls the addRoute function itself seems to have the right value on the options object.

Could someone point out what I could be doing wrong?

Upvotes: 0

Views: 1958

Answers (1)

Hari Pachuveetil
Hari Pachuveetil

Reputation: 10374

Looks like it is case of case mismatch - Url vs URL

The documentation still has the parameter as ignoreUrlParametersMatching (which is where I copy-pasted from) - and the addRoute function recently has changed the parameter to ignoreURLParametersMatching.

Upvotes: 4

Related Questions