Skip to content

Commit

Permalink
fix: 🐛 msw service worker url on prod
Browse files Browse the repository at this point in the history
  • Loading branch information
singhAmandeep007 committed Nov 25, 2024
1 parent d365125 commit 8ade922
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/mocker/server.ts
Original file line number Diff line number Diff line change
@@ -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`,
},
});
};

0 comments on commit 8ade922

Please sign in to comment.