Skip to content

Commit

Permalink
Support @storybook/experimental-nextjs-vite
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinpalkovic committed Aug 6, 2024
1 parent bced89b commit 259c485
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# vite-plugin-storybook-nextjs

This is a Vite plugin that allows you to use Next.js features in Vite. It is the basis for `@storybook/nextjs-vite` and should be used when running portable stories in Vitest.
This is a Vite plugin that allows you to use Next.js features in Vite. It is the basis for `@storybook/experimental-nextjs-vite` and should be used when running portable stories in Vitest.

## Features

- **Next.js Integration**: Seamlessly integrate Next.js features into your Vite project.
- **Storybook Compatibility**: Acts as the foundation for `@storybook/nextjs-vite`, enabling you to use Storybook with Next.js in a Vite environment.
- **Storybook Compatibility**: Acts as the foundation for `@storybook/experimental-nextjs-vite`, enabling you to use Storybook with Next.js in a Vite environment.
- **Portable Stories**: Ideal for running portable stories in Vitest, ensuring your components are tested in an environment that closely mirrors production.

## Installation
Expand Down
13 changes: 13 additions & 0 deletions src/plugins/next-mocks/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,28 @@ export const getAlias = (env: Env) => ({
"next/headers": getEntryPoint("headers", env),
"@storybook/nextjs/headers.mock": getEntryPoint("headers", env),
"@storybook/nextjs-vite/headers.mock": getEntryPoint("headers", env),
"@storybook/experimental-nextjs-vite/headers.mock": getEntryPoint(
"headers",
env,
),
"next/navigation": getEntryPoint("navigation", env),
"@storybook/nextjs/navigation.mock": getEntryPoint("navigation", env),
"@storybook/nextjs-vite/navigation.mock": getEntryPoint("navigation", env),
"@storybook/experimental-nextjs-vite/navigation.mock": getEntryPoint(
"navigation",
env,
),
"next/router": getEntryPoint("router", env),
"@storybook/nextjs/router.mock": getEntryPoint("router", env),
"@storybook/nextjs-vite/router.mock": getEntryPoint("router", env),
"@storybook/experimental-nextjs-vite/router.mock": getEntryPoint(
"router",
env,
),
"next/cache": getEntryPoint("cache", env),
"@storybook/nextjs/cache.mock": getEntryPoint("cache", env),
"@storybook/nextjs-vite/cache.mock": getEntryPoint("cache", env),
"@storybook/experimental-nextjs-vite/cache.mock": getEntryPoint("cache", env),
"server-only": getEntryPoint("server-only", env),
"@opentelemetry/api": require.resolve(
"next/dist/compiled/@opentelemetry/api",
Expand Down

0 comments on commit 259c485

Please sign in to comment.