Skip to content

Playground from dev server does not load in Firefox #1196

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

Closed
brandonpayton opened this issue Apr 4, 2024 · 2 comments
Closed

Playground from dev server does not load in Firefox #1196

brandonpayton opened this issue Apr 4, 2024 · 2 comments

Comments

@brandonpayton
Copy link
Member

brandonpayton commented Apr 4, 2024

When using npm run dev, Firefox 115.9.1esr is unable to load Playground from http://localhost:5400/website-server/.

It starts loading but fails with the error:

TypeError: ServiceWorker script at http://localhost:5400/service-worker.ts?type=module&worker_file for scope http://localhost:5400/ threw an exception during script evaluation.

Here's a full screenshot:
image

I am unable to get further information on the error, but I believe the error is likely due to the fact that Firefox does not support ES modules as ServiceWorker scripts. See the support matrix on MDN.

Screenshot 2024-04-04 at 2 55 38 PM

Interestingly, Playground from playground.wordpress.net loads fine in Firefox . There we are still registering the ServiceWorker with type: "module", but https://playground.wordpress.net/sw.js does not appear to have any module-related syntax. A snapshot of the current, transpiled sw.js content can be found here.

Perhaps Firefox's lack of ServiceWorker module support is also causing #1180.

@bgrgicak
Copy link
Collaborator

bgrgicak commented Apr 5, 2024

This could be resolved by #1086

I was able to get it to work in another project that uses Vite, but it required rewriting the SW registration to work with Vite PWA.

@brandonpayton
Copy link
Member Author

Thank you for mentioning that @bgrgicak. Is it possible that our PWA work may help us solve this for "free"?

Closing this issue as a duplicate of #330.

@brandonpayton brandonpayton closed this as not planned Won't fix, can't repro, duplicate, stale Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants