webpackFinal
¥Parent: main.js|ts configuration
类型:async (config: Config, options: WebpackOptions) => Config
¥Type: async (config: Config, options: WebpackOptions) => Config
使用 webpack 构建器 时自定义 Storybook 的 Webpack 设置。
¥Customize Storybook's Webpack setup when using the webpack builder.
.storybook/main.ts
// 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)'],
webpackFinal: async (config, { configType }) => {
if (configType === 'DEVELOPMENT') {
// Modify config for development
}
if (configType === 'PRODUCTION') {
// Modify config for production
}
return config;
},
};
export default config;
Options
类型:{ configType?: 'DEVELOPMENT' | 'PRODUCTION' }
¥Type: { configType?: 'DEVELOPMENT' | 'PRODUCTION' }
还有其他难以在此处记录的选项。请自省类型定义以获取更多信息。
¥There are other options that are difficult to document here. Please introspect the type definition for more information.