mirror of
https://github.com/FoxxMD/multi-scrobbler.git
synced 2026-07-09 17:28:28 +00:00
fix(storybook): Fix duplicate msw workers due to vite hot reload
This commit is contained in:
parent
94d3ea5da8
commit
6d503a1a15
1 changed files with 7 additions and 2 deletions
|
|
@ -3,9 +3,14 @@ import addonA11y from "@storybook/addon-a11y";
|
|||
import { definePreview } from "@storybook/react-vite";
|
||||
|
||||
import { themes } from 'storybook/theming';
|
||||
import { initialize, mswLoader } from 'msw-storybook-addon';
|
||||
import { initialize, mswLoader, getWorker } from 'msw-storybook-addon';
|
||||
|
||||
initialize();
|
||||
// https://github.com/mswjs/msw-storybook-addon/issues/82#issuecomment-3894302575
|
||||
try {
|
||||
getWorker();
|
||||
} catch (_) {
|
||||
initialize();
|
||||
}
|
||||
|
||||
export default definePreview({
|
||||
loaders: [mswLoader],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue