vite-pwa / vite-plugin-pwa

Zero-config PWA for Vite
https://vite-pwa-org.netlify.app/
MIT License
3.22k stars 211 forks source link

service-workers and search params #769

Open Iran-110 opened 1 month ago

Iran-110 commented 1 month ago

Description

For advanced use of service workers, such as versioning or complex caching, we sometimes need to send data to the service worker using search parameters like /sw.js?ver=1.2.

This PR helps to solve this issue.

Linked Issues

resolves #587.

Additional Context

I use this pattern: https://github.com/vite-pwa/vite-plugin-pwa/issues/587#issuecomment-1818073650

netlify[bot] commented 1 month ago

Deploy Preview for vite-plugin-pwa-legacy ready!

Name Link
Latest commit b901a7fe01c5828901841e52dfda24327b8f05c2
Latest deploy log https://app.netlify.com/sites/vite-plugin-pwa-legacy/deploys/670dc3f8593d4e00087d2df9
Deploy Preview https://deploy-preview-769--vite-plugin-pwa-legacy.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

userquin commented 1 month ago

This should also work in dev mode, have you check it with some example? I'll try to review this PR next weekend (too busy, sorry )

Revert changes added to the docs, those changes should go to the docs repo here: https://github.com/vite-pwa/docs

Changes made to the examples won't pass Playwright tests (update PWA tests in the corresponding client-test folders or add an example only to some example not included in PW tests, check test script in root package.json): try running pnpm test from root folder, Playwright tests checking for the sw url in the browser page.