Skip to content
9 changes: 9 additions & 0 deletions docs/_snippets/vite-includeStorybookNextjsPlugin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
```ts filename="vitest.config.ts" renderer="react" language="ts"
import { defineConfig } from "vite";
import { storybookNextJsPlugin } from '@storybook/nextjs-vite/vite-plugin'

export default defineConfig({
// only necessary when not using @storybook/addon-vitest, otherwise the plugin is loaded automatically
plugins: [storybookNextJsPlugin()],
});
```
10 changes: 10 additions & 0 deletions docs/writing-tests/integrations/stories-in-unit-tests.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@ Storybook provides community-led addons for other frameworks like [Vue 2](https:
<CodeSnippets path="reuse-args-test.md" />

{/* prettier-ignore-end */}

### Next.js Vite cannot find the module

If you are seeing error messages like `Cannot find module 'sb-original/image-context'` ensure you have included `storybookNextJsPlugin`.

{/* prettier-ignore-start */}

<CodeSnippets path="vite-includeStorybookNextjsPlugin.md" />

{/* prettier-ignore-end */}
</IfRenderer>

<IfRenderer renderer="vue">
Expand Down
Loading