【发布时间】:2022-01-18 14:31:34
【问题描述】:
今天我创建了一个新的 CRA 项目(运行良好),但是当我使用 npx sb init 添加 Storybook 时出现此错误:
info @storybook/react v6.4.9
info => Loading presets
info => Serving static files from ./public at /
info => Loading Webpack configuration from `node_modules/react-scripts`
info => Removing existing JavaScript and TypeScript rules.
info => Modifying Create React App rules.
info => Using default Webpack5 setup
ERR! ValidationError: Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
ERR! - configuration.module.rules[4] should be one of these:
ERR! ["..." | object { assert?, compiler?, dependency?, descriptionData?, enforce?, exclude?, generator?, include?, issuer?, issuerLayer?, layer?, loader?, mimetype?, oneOf?, options?, parser?, realResource?, resolve?, resource?, resourceFragment?, resourceQuery?, rules?, scheme?, sideEffects?, test?, type?, use? }, ...]
我尝试了很多东西都没有结果。
会是什么?
谢谢!
【问题讨论】:
-
看来您在 webpack 配置中存在配置问题。这指向第 4 条规则。
-
这在默认安装中正常吗?
标签: javascript reactjs typescript webpack storybook