vite-pwa / vite-plugin-pwa

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

SW not working with cross origin headers (sharedArrayBuffers) #709

Open Sceat opened 6 months ago

Sceat commented 6 months ago

Using this vercel config (basically enabling the headers to access SharedArrayBuffers), makes it impossible to use the service worker somehow.

"headers": [
    {
      "source": "/(.*)",
      "headers": [
        {
          "key": "Cross-Origin-Embedder-Policy",
          "value": "require-corp"
        },
        {
          "key": "Cross-Origin-Opener-Policy",
          "value": "same-origin"
        }
      ]
    }
  ],

It registers but then throws:

uncaught (in promise) TypeError: Type error sw.js:1
userquin commented 6 months ago

@Sceat provide minimal reproduction (and context 🙏 )