From 6da66812fe6e427b10f1bda67efab25e9ea9e018 Mon Sep 17 00:00:00 2001 From: Christopher Dieringer Date: Mon, 3 Nov 2025 12:18:36 -0800 Subject: [PATCH] docs: Update custom-worker-script-location.mdx # problem I was getting errors and warnings despite setting the Service-Worker-Allowed header. # solution clarify that you MUST tell MSW about the scope! --- .../content/docs/recipes/custom-worker-script-location.mdx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/websites/mswjs.io/src/content/docs/recipes/custom-worker-script-location.mdx b/websites/mswjs.io/src/content/docs/recipes/custom-worker-script-location.mdx index 08ef0968..ccade4cf 100644 --- a/websites/mswjs.io/src/content/docs/recipes/custom-worker-script-location.mdx +++ b/websites/mswjs.io/src/content/docs/recipes/custom-worker-script-location.mdx @@ -12,6 +12,10 @@ await worker.start({ // This is useful if your application follows // a strict directory structure. url: '/assets/mockServiceWorker.js', + options: { + // Required if you opt-in to Service-Worker-Allowed header + scope: "YOUR_TARGET_SCOPE", + }, }, }) ```