Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtimeCaching urlPattern and pagesURLPattern only accept strings #527

Open
gavmck opened this issue Jun 29, 2022 · 2 comments
Open

runtimeCaching urlPattern and pagesURLPattern only accept strings #527

gavmck opened this issue Jun 29, 2022 · 2 comments

Comments

@gavmck
Copy link

gavmck commented Jun 29, 2022

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
Copy link

FreekVR commented May 26, 2023

+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.

@IgorDev8
Copy link

Everything works, you just need to format it correctly, like this:

urlPattern: '.(?:png|jpg|jpeg|svg|gif)$'.

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

No branches or pull requests

3 participants