Hello, I’m struggling with the following error for some time:
TypeError: Failed to register a ServiceWorker for scope (‘http://localhost/’) with script (‘http://localhost/sw.js’): An unknown error occurred when fetching the script.
The actual code: https://codesandbox.io/s/simple-pwa-capacitor-v03xc3
Basically I took the PWA example from here: https://github.com/mdn/pwa-examples/tree/main/a2hs
Then followed the instructions for capacitor here: https://capacitorjs.com/docs/getting-started#add-capacitor-to-your-web-app
In the browser runs fine, service worker registers ok.
However, when running in Android (npx cap sync && npx cap open android), in an Emulator, i get the error above.
What is the issue here? Thank you in advance. If any additional details needed, please let me know.