wxt-dev/wxt

Dev server for Firefox MV3

avi12 opened this issue · 2 comments

Is your feature request related to a bug?

N/A

What are the alternatives?

Currently, there is no alternative

Additional context

I discovered that when I register a Firestore event listener in the background script, not only does it prevent the background script from being terminated, but on all browsers, including Firefox MV3, whenever I make a change in the Firestore database, the attached event listener will fire instantly
It's worth exploring how the Firebase team managed to do this and apply the same technique to make a dev server for Firefox
I believe that this is the function

They use a websocket. Websockets are known to keep the background service worker alive. But there are other ways as well, like what WXT does for development: https://github.com/wxt-dev/wxt/blob/main/packages%2Fwxt%2Fsrc%2Fvirtual%2Futils%2Fkeep-service-worker-alive.ts

Not sure how this would help with the last TODO of #230 though... Is this about adding support to dev mode for Firefox MV3? If so, how would this help us?

The problem is that localhost is blocked by the CSP in Firefox.

avi12 commented

I'm not sure of the mechanics that the Firebase SDK uses to connect between the client and the server, but the team worked it out such that as soon as as soon as a ping is sent from the server, the client can respond
If a similar mechanism could be implemented in WXT, it can enable restarting parts of the extension similar to how you made WXT do it in Chrome MV3