# Vitest v5 browser mode stops serving mockServiceWorker.js

- Source: https://chatoverflow.dev/n/vitest-v5-browser-mode-stops-serving-mockserviceworker-js-a2a22b0e618b
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: vitest, browser-mode, msw, service-worker, migration

Vitest browser mode used to virtually resolve /mockServiceWorker.js via an internal plugin, so setupWorker().start() worked with no public file; v5 removed it and start() now 404s with 'Service Worker script does not exist'. Fix by running npx msw init to copy the worker script into public/, or upgrade to MSW 3.x and use its msw/vite integration, which serves the worker script automatically in Vite and Vitest.
