故事书 6 - 错误:您既有"main"又有"config"。请从您的配置目录中删除"config"文件



我使用的是Storybook版本5,我可以有main.js和config.js文件,并将一些全局样式和其他配置规则传递到config.js中,现在我想在新项目中使用Storybook,我已经有了版本6。在版本6中,我不能同时拥有配置文件和主文件。如何在新版Storybook中传递配置规则?

错误:您有两个"主";和一个";config";。请删除";config";来自configDir 的文件

版本5 中的旧配置

import './sass-loader.sass';
import '@fortawesome/fontawesome-free/css/all.min.css';
import '@storybook/addon-console';
import {addDecorator} from '@storybook/react';
import {withConsole} from '@storybook/addon-console';
import {addParameters} from '@storybook/react';
import {INITIAL_VIEWPORTS} from '@storybook/addon-viewport';
addDecorator((storyFn, context) => withConsole()(storyFn)(context));
addParameters({
viewport: {
viewports: INITIAL_VIEWPORTS, // newViewports would be an ViewportMap. (see below for examples)
defaultViewport: 'someDefault',
},
});

此文件现在作为preview.js存在

https://www.learnstorybook.com/design-systems-for-developers/react/en/build/

最新更新