Use MSW inside a Service Worker #1386
Unanswered
thebergamo
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Hey, @thebergamo. Have you tried composing your workers using // your-worker.js
importScripts('./mockServiceWorker.js')
// the rest of your worker code that makes requests. Once you do this, register worker.start({
serviceWorer: {
url: '/your-worker.js'
}
}) Pay attention which worker imports which, as I believe that will affect how the worker events like "fetch" will be resolved. Let me know if this works. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
First of all, MSW is great and I love it <3
These days I stumped my toes in an issue related to my requests that were done inside my "service worker" where not intercepted by MSW and while I tried to register the MSW worker inside my custom service worker it throws me an error that window is not defined.
Is it even possible to intercept requests done inside my service worker using MSW?
Beta Was this translation helpful? Give feedback.
All reactions