Storybook 6 - Error: You have both a "main" and a "config". Please remove the "config" file from your configDir

Storybook 6 - Error: You have both a "main" and a "config". Please remove the "config" file from your configDir

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

Error: You have both a "main" and a "config". Please remove the "config" file from your 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/