msw-storybook-addon
msw-storybook-addon copied to clipboard
Help when building storybook and deploying on Vercel
I'm pretty new to Storybook, and hope you can help me out here.
I have msw-storybook-addon
installed version 1.10.0
, working fine running locally on my machine.
When I try to build the storybook with the storybook build
command, everything also seems to work on Vercel. However, when I visit the environment I get this error:
[MSW] Failed to register a Service Worker for scope ('https://ui-seven-kappa.vercel.app/') with script ('https://ui-seven-kappa.vercel.app/mockServiceWorker.js'): Service Worker script does not exist at the given path.
Did you forget to run "npx msw init <PUBLIC_DIR>"?
Learn more about creating the Service Worker script: https://mswjs.io/docs/cli/init
I tried adding
"msw": {
"workerDirectory": "public"
}
But that did not seem to help.
On Vercel I'm using the Storybook framework preset, that lists storybook-static
as "Output directory".
What is wrong with the above configuration 🧐?