module-federation / module-federation-examples

Implementation examples of module federation , by the creators of module federation
https://module-federation.io/
MIT License
5.56k stars 1.73k forks source link

Implementing PWA/Service Worker in Angular module federation monorepo #3018

Closed thiagopg84 closed 1 year ago

thiagopg84 commented 1 year ago

Hello! I'm trying to implement PWA/Service Worker in an Angular module federation monorepo. This is what I've tried so far:

  1. Created one service worker for each app (shell and remotes);
  2. Created one service worker for the shell app.

None of these approaches seem to work. Are there any examples of which approach should be used in this case?

kiruthin commented 1 year ago

Curious as well. Was looking to implement something similar.

manuelc2209 commented 1 year ago

@ScriptedAlchemy you need a reverse proxy to register them on the Host, otherwise a remote will not be able to register on hosts url, correct?

thiagopg84 commented 1 year ago

@manuelc2209 Could you please provide a quick example or elaborate your explanation?

manuelc2209 commented 1 year ago

I need validation too from @ScriptedAlchemy on that topic, facing the same use case. Thats the only logical thing ive found regarding it since you cant register two SWs for the same path

ScriptedAlchemy commented 1 year ago

@zackarychapple would help with angular side of things.

As for service worker in general, yes its possible to do that. If you want MFP in service worker then youd likely want to set the library type t worker or whatver its the right target for the runtime to operate in