firebase / friendlyeats-web

Apache License 2.0
437 stars 393 forks source link

Question: How does the auth-service-worker.js get packaged? #293

Closed rlw87 closed 1 month ago

rlw87 commented 1 month ago

Following the recent next.js firebase app hosting guide and this repository I cannot get the auth-service-worker to work in my project. I cannot see how auth-service-worker.js makes its way into the public folder so it can be registered by the Header component on the client side.

I'm using typescript for my project, but I don't see how this part of the process would be different. I have even tried transpiling the service worker myself, but as it needs to import firebase auth I get errors telling me that "require" and "exports" are not defined. I can't convert it to an ES Module as module aren't supported within service workers.

How does this example work?

rlw87 commented 1 month ago

The answer is that it's in the package.json and uses esbuild every time you run npm build