Vite plugin enabling Next.js features in Vite environments, primarily for Storybook portable stories in Vitest. Current stable version 3.2.4, actively maintained by Storybook team. Released monthly with patch and minor updates. Key differentiator: bridges Next.js-specific APIs (image optimization, SWC compilation, routing) with Vite-based testing/Storybook workflows. Supports Next.js 14-16, Storybook 9-10, Vite 5-8. Includes TypeScript types. Based on official Storybook integration.
npm install vite-plugin-storybook-nextjsVerified import paths — ran on the pinned version, not inferred.
Configures Vitest to use the Next.js plugin, enabling testing of Next.js components in Vite.
Enable `resolve.tsconfigPaths: true` in Vite config.
Set `image.exclude: ['**/*.svg?react']` in plugin options.
Use `vite-plugin-storybook-nextjs` directly in Vitest config; the experimental package re-exports it.
Install `@types/node` and ensure `tsconfig.json` includes `"types": ["node"]`.
Check peer deps: next >=14.1.0. Verify plugin is added to Vite config as `next()`.