docs/_snippets/msw-addon-initialize.md
import { mswLoader } from 'msw-storybook-addon/csf3';
export default {
/*
* Register the MSW loader for all stories
* See https://github.com/mswjs/msw-storybook-addon#csf-30
* to learn how to customize it
*/
loaders: [mswLoader()],
};
// Replace your-framework with the framework you are using, e.g. react-vite, nextjs, vue3-vite, etc.
import type { Preview } from '@storybook/your-framework';
import { mswLoader } from 'msw-storybook-addon/csf3';
const preview: Preview = {
/*
* Register the MSW loader for all stories
* See https://github.com/mswjs/msw-storybook-addon#csf-30
* to learn how to customize it
*/
loaders: [mswLoader()],
};
export default preview;
// Replace your-framework with the framework you are using (e.g., react-vite, nextjs, nextjs-vite)
import { definePreview } from '@storybook/your-framework';
import addonMsw from 'msw-storybook-addon';
export default definePreview({
/*
* Register the MSW loader for all stories
* See https://github.com/mswjs/msw-storybook-addon#csf-next
* to learn how to customize it
*/
addons: [addonMsw()],
});
// Replace your-framework with the framework you are using (e.g., react-vite, nextjs, nextjs-vite)
import { definePreview } from '@storybook/your-framework';
import addonMsw from 'msw-storybook-addon';
export default definePreview({
/*
* Register the MSW loader for all stories
* See https://github.com/mswjs/msw-storybook-addon#csf-next
* to learn how to customize it
*/
addons: [addonMsw()],
});
import { definePreview } from '@storybook/vue3-vite';
import addonMsw from 'msw-storybook-addon';
export default definePreview({
/*
* Register the MSW loader for all stories
* See https://github.com/mswjs/msw-storybook-addon#csf-next
* to learn how to customize it
*/
addons: [addonMsw()],
});
import { definePreview } from '@storybook/vue3-vite';
import addonMsw from 'msw-storybook-addon';
export default definePreview({
/*
* Register the MSW loader for all stories
* See https://github.com/mswjs/msw-storybook-addon#csf-next
* to learn how to customize it
*/
addons: [addonMsw()],
});
import { definePreview } from '@storybook/angular';
import addonMsw from 'msw-storybook-addon';
export default definePreview({
/*
* Register the MSW loader for all stories
* See https://github.com/mswjs/msw-storybook-addon#csf-next
* to learn how to customize it
*/
addons: [addonMsw()],
});
import { definePreview } from '@storybook/web-components-vite';
import addonMsw from 'msw-storybook-addon';
export default definePreview({
/*
* Register the MSW loader for all stories
* See https://github.com/mswjs/msw-storybook-addon#csf-next
* to learn how to customize it
*/
addons: [addonMsw()],
});
import { definePreview } from '@storybook/web-components-vite';
import addonMsw from 'msw-storybook-addon';
export default definePreview({
/*
* Register the MSW loader for all stories
* See https://github.com/mswjs/msw-storybook-addon#csf-next
* to learn how to customize it
*/
addons: [addonMsw()],
});