父级: main.js|ts 配置
类型: (config: { [key: string]: string }) => { [key: string]: string }
(config: { [key: string]: string }) => { [key: string]: string }
定义自定义 Storybook 环境变量.
// Replace your-framework with the framework you are using (e.g., react-webpack5, vue3-vite) import type { StorybookConfig } from '@storybook/your-framework'; const config: StorybookConfig = { framework: '@storybook/your-framework', stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'], /* * 👇 The `config` argument contains all the other existing environment variables. * Either configured in an `.env` file or configured on the command line. */ env: (config) => ({ ...config, EXAMPLE_VAR: 'An environment variable configured in Storybook', }), }; export default config;