Docs
Storybook Docs

framework

(必需)

¥(Required)

父级:main.js|ts 配置

¥Parent: main.js|ts configuration

类型:FrameworkName | { name: FrameworkName; options?: FrameworkOptions }

¥Type: FrameworkName | { name: FrameworkName; options?: FrameworkOptions }

根据一组 framework-specific 设置配置 Storybook。

¥Configures Storybook based on a set of framework-specific settings.

.storybook/main.ts
// Replace react-vite with the framework you are using (e.g., react-webpack5)
import type { StorybookConfig } from '@storybook/react-vite';
 
const config: StorybookConfig = {
  framework: {
    name: '@storybook/react-vite',
    options: {
      legacyRootApi: true,
    },
  },
  stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
};
 
export default config;

name

类型:string

¥Type: string

有关可用框架及其选项,请参阅其各自的 documentation

¥For available frameworks and their options, see their respective documentation.

options

类型:Record<string, any>

¥Type: Record<string, any>

虽然许多选项特定于框架,但有些选项是跨某些框架共享的,例如那些配置 Storybook 的 builder 的选项。

¥While many options are specific to a framework, there are some options that are shared across some frameworks, e.g. those that configure Storybook's builder.

options.builder

类型:Record<string, any>

¥Type: Record<string, any>

配置 Storybook 的构建器,ViteWebpack

¥Configures Storybook's builder, Vite or Webpack.