nuxt-community / pwa-module

Zero config PWA solution for Nuxt.js
https://pwa.nuxtjs.org
MIT License
1.23k stars 171 forks source link

runtimeCaching urlPattern and pagesURLPattern only accept strings #527

Open gavmck opened 2 years ago

gavmck commented 2 years ago

The urlPattern in runtimeCaching and the pageURLPattern option, both only accept strings.

The docs for pagesURLPattern suggest it accepts either a string or a RegEx, but this does not work. There are no examples for a runtimeCaching object other than under "Adding custom runtimeCaching items for CDN".

Workbox itself accepts RegEx, string or match function.

FreekVR commented 1 year ago

+1 on this, it actually says in the docs regex is supported: https://pwa.nuxtjs.org/workbox/#pagesurlpattern

But setting it like this will result in an empty string being passed to workbox: pagesURLPattern: /^(?!\/auth).*$/

As I am trying to use a regex to exclude only some pages, I cannot get this to work with a string notation.