Skip to content

Help when building storybook and deploying on Vercel #136

@alexbjorlig

Description

@alexbjorlig

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 🧐?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions