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`, + }, }); };