🔧 fix: Fetch PWA Manifest with credentials over CORS (#5156)

When behind authentication (for eg: Cloudflare Access), browsers
won't send credentials when fetching the manifest file by default.

To fix, this change adds `crossorigin="use-credentials"` to the
manifest link tag by enabling the `useCredentials` option in
VitePWA.
This commit is contained in:
Sam Lewis 2025-02-04 02:54:10 +11:00 committed by GitHub
parent 45dd2b262f
commit d7dc58dd23
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -59,6 +59,7 @@ export default defineConfig({
devOptions: {
enabled: false, // enable/disable registering SW in development mode
},
useCredentials: true,
workbox: {
globPatterns: ['assets/**/*.{png,jpg,svg,ico}', '**/*.{js,css,html,ico,woff2}'],
maximumFileSizeToCacheInBytes: 4 * 1024 * 1024,