Back to Storybook

React Vite Add Framework

docs/_snippets/react-vite-add-framework.md

10.3.61.4 KB
Original Source
js
export default {
  // ...
  // framework: '@storybook/react-webpack5', ๐Ÿ‘ˆ Remove this
  framework: '@storybook/react-vite', // ๐Ÿ‘ˆ Add this
};
ts
import type { StorybookConfig } from '@storybook/react-vite';

const config: StorybookConfig = {
  // ...
  // framework: '@storybook/react-webpack5', ๐Ÿ‘ˆ Remove this
  framework: '@storybook/react-vite', // ๐Ÿ‘ˆ Add this
};

export default config;
ts
// Replace your-framework with the framework you are using (e.g., react-vite, nextjs, nextjs-vite)
import { defineMain } from '@storybook/your-framework/node';

export default defineMain({
  // ...
  // framework: '@storybook/react-webpack5', ๐Ÿ‘ˆ Remove this
  framework: '@storybook/react-vite', // ๐Ÿ‘ˆ Add this
});
<!-- JS snippets still needed while providing both CSF 3 & Next -->
js
// Replace your-framework with the framework you are using (e.g., react-vite, nextjs, nextjs-vite)
import { defineMain } from '@storybook/your-framework/node';

export default defineMain({
  // ...
  // framework: '@storybook/react-webpack5', ๐Ÿ‘ˆ Remove this
  framework: '@storybook/react-vite', // ๐Ÿ‘ˆ Add this
});