Replies: 1 comment
-
You need a reverse proxy since you cant run workers off other origins |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a small setup with webpack module federation, one container app and one remote. The remote is exposing itself completely and the container is consuming it to show it after clicking a navigation link like
/users
.The container is reachable at
localhost:8080
, the remote atlocalhost:3001
Now, the remote is using mockup service worker (https://mswjs.io/), which works fine when visiting the app directly. When called through the container, an error comes up:
Uncaught (in promise) Error: [MSW] Failed to register a Service Worker for scope ('http://localhost:8080/') with script ('http://localhost:8080/mockServiceWorker.js'): Service Worker script does not exist at the given path.
I also tried setting the scope with
which resolves in an error
Failed to register a ServiceWorker: The origin of the provided scope ('http://localhost:3001') does not match the current origin ('http://localhost:8080')
.Does anyone have experiences with this? Using service workers in remotes with module federation? How to call them in the container?
Beta Was this translation helpful? Give feedback.
All reactions