加载反应故事书时出现问题



我无法启动我的故事书应用程序。它只加载加载状态(加载层(。控制台中没有任何错误。我做错了什么?屏幕截图

故事书/main.js

const path = require('path')
const autoprefixer = require('autoprefixer')
const lost = require('lost')
const processors = [
autoprefixer({
grid: true
}),
lost()
]
module.exports = {
stories: ['../app/ui/**/*.stories.js'],
webpack: (config) => {
config.module.rules.push({
test: /.scss$/,
use: [
'cache-loader',
'style-loader',
{ loader: 'css-loader', options: { sourceMap: true } },
{
loader: 'postcss-loader',
options: {
sourceMap: true,
plugins: (loader) => processors
}
},
{ loader: 'sass-loader', options: { sourceMap: true } }
],
include: path.resolve(__dirname, '../')
})
return config
}
}

Button.stories.js(示例组件(

import React from 'react'
import Button from './Button'
export default { component: Button, title: 'Button' }
export const withText = () => <Button>Hello Button</Button>
export const bigSizes = () => (
<Button
size='big'
color='ultra-light-gray'
borderRadius='big'
>
Big grey btn
</Button>
)

系统:

系统:操作系统:Windows 10 10.0.18363二进制文件:节点:12.14.1-C:\Program Files\nodejs\Node.EXEnpm:6.13.6-C:\Program Files\nodejs\npm.CMD浏览器:边缘:44.18362.449.0npm软件包:@故事书/反应:^5.3.18=>5.3.18

通过将故事书更新到最新版本,我消除了这种冲突。

npxsb@latest升级

如果您有@storybook/preset-create-react-app,请检查您是否也没有将其更新到更高版本。对我来说,这是在我尝试更新两者时发生的。当它恢复到较低版本(在我的情况下是^3.2.0(,并且只是故事书更新到^6.5.4时,一切都恢复了。

可能值得检查除此之外的其他故事书依赖项,并使用不同的版本组合。

最新更新