mglaman / wasm-drupal

Drupal in WASM
https://wasm-drupal.mglaman.dev/
MIT License
21 stars 2 forks source link

Firefox does not support ECMAScript modules in service workers #21

Closed nlighteneddesign closed 1 day ago

nlighteneddesign commented 3 days ago

When I visit https://wasm-drupal.mglaman.dev/ I only get a loading ... button then I receive this error in the console:

Waiting for service worker... [wasm-drupal.mglaman.dev:32:21](https://wasm-drupal.mglaman.dev/)
Uncaught (in promise) TypeError: ServiceWorker script at https://wasm-drupal.mglaman.dev/worker.mjs for scope https://wasm-drupal.mglaman.dev/ threw an exception during script evaluation.
nlighteneddesign commented 3 days ago

Firefox does not support modules in service workers: https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorker#browser_compatibility

mglaman commented 3 days ago

I was so excited to use modules directly without bundling the code :(

mglaman commented 3 days ago

Ugh Firefox supports them in Worklet API but not Service Worker API

mglaman commented 3 days ago

I can't even find the proper Firefox bug. They consider it feature complete, it seems, although it's only for Workers https://bugzilla.mozilla.org/show_bug.cgi?id=1247687

mglaman commented 3 days ago

Found it! https://bugzilla.mozilla.org/show_bug.cgi?id=1360870

gitressa commented 2 days ago

This is an amazing concept, thanks for building it @mglaman. Perhaps a note could be added on the project page, that it doesn't yet work in Firefox?

mglaman commented 2 days ago

Yes, I've wanted to push an update on the landing page about Firefox and Safari. I have just been really busy this morning and hopefully I will soon

gitressa commented 2 days ago

I feel kinda bad, and almost didn't send the comment, since I didn't want to be a negative downer ... but it sounds great with the update, thanks!

For a Firefox solution, would it help if the Drupal community got involved in the Bugzilla bug Implement "module" service workers and fixing that, or do you think it can be worked around in this project?

mglaman commented 2 days ago

No problem I don't see it as being a negative downer at all.

It can be worked around in this project. I need to use Rollup (or Vite to simplify Rollip config) or Webpack to bundle the assets.

gitressa commented 2 days ago

Sounds fantastic, I am very much looking forward to trying it.

mglaman commented 2 days ago

It's not a full fix, but with https://github.com/mglaman/wasm-drupal/pull/29 the two known browser issues have been linked. And if there is an error loading the service worker (FF) it shows an alert.

mglaman commented 1 day ago

I tried with Vite and failed miserably. I'm going to try again later with webpack just for the service worker.

nlighteneddesign commented 1 day ago

I just learned about https://www.rspack.dev/ which is supposed to be webpack like and way faster

On Wed, Jul 3, 2024, 6:29 PM Matt Glaman @.***> wrote:

I tried with Vite and failed miserably. I'm going to try again later with webpack just for the service worker.

— Reply to this email directly, view it on GitHub https://github.com/mglaman/wasm-drupal/issues/21#issuecomment-2207415032, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZPIG6IUSALU52TK4CR5ZDZKR3LVAVCNFSM6AAAAABKHW7YU6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBXGQYTKMBTGI . You are receiving this because you authored the thread.Message ID: @.***>

nlighteneddesign commented 1 day ago

Let me take a quick look at this.

mglaman commented 1 day ago

It looks like https://github.com/mglaman/wasm-drupal/pull/31 will fix loading. But then there are a handful of other issues, like some files being missing/corrupted. Tracking with https://github.com/mglaman/wasm-drupal/issues/32

gitressa commented 1 day ago

Yes, it works and I can install in Firefox, awesome!

And also as mentioned, some files are missing, but there's an issue for that, so that's already on the radar.