From 8ade922c3d1e8334e2d65f329089630dc620e872 Mon Sep 17 00:00:00 2001 From: singhAmandeep007 Date: Mon, 25 Nov 2024 12:46:34 +0530 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20msw=20service=20worker=20?= =?UTF-8?q?url=20on=20prod?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mocker/server.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mocker/server.ts b/src/mocker/server.ts index 50ec1f3..b031aa0 100644 --- a/src/mocker/server.ts +++ b/src/mocker/server.ts @@ -1,11 +1,17 @@ import { setupWorker } from "msw/browser"; +import { isProduction } from "../utils"; import { handlers } from "./handlers"; const worker = setupWorker(...handlers); +const baseUrl = isProduction ? "https://singhamandeep.me/react-vite-boilerplate/" : "/"; + export const runServer = () => { return worker.start({ onUnhandledRequest: "bypass", + serviceWorker: { + url: `${baseUrl}mockServiceWorker.js`, + }, }); };