[Bug]:如果globs目标.mdx文件,但未配置addon-docs,Vite Storybook会静默失败并显示空白屏幕,

xu3bshqb  于 4个月前  发布在  其他
关注(0)|答案(2)|浏览(42)

描述bug

在以下场景中:

  1. 使用基于Vite的框架
  2. Stories globs目标.mdx以某种方式(如默认值)
  3. @storybook/addon-docs没有在主配置中配置,既没有明确地也没有@storybook/addon-essentials
    Storybook启动"正常",但显示空白屏幕无内容,终端中没有错误。浏览器控制台有React错误。

重现步骤

https://stackblitz.com/edit/github-g8fqna?file=.storybook/main.js

系统信息

  • 无响应*

其他上下文信息

基于Webpack的项目将无法启动:

ModuleParseError: Module parse failed: Unexpected token (11:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| import StackAlt from './assets/stackalt.svg';
|
> <Meta title="Example/Introduction" />
|
| <style>
    at handleParseError (/Users/jeppe/dev/temp/sb-no-addons-wp/node_modules/webpack/lib/NormalModule.js:741:23)
    at /Users/jeppe/dev/temp/sb-no-addons-wp/node_modules/webpack/lib/NormalModule.js:843:9
    at processResult (/Users/jeppe/dev/temp/sb-no-addons-wp/node_modules/webpack/lib/NormalModule.js:597:14)
    at /Users/jeppe/dev/temp/sb-no-addons-wp/node_modules/webpack/lib/NormalModule.js:646:9
    at /Users/jeppe/dev/temp/sb-no-addons-wp/node_modules/loader-runner/lib/LoaderRunner.js:368:5
    at iterateNormalLoaders (/Users/jeppe/dev/temp/sb-no-addons-wp/node_modules/loader-runner/lib/LoaderRunner.js:213:12)
    at /Users/jeppe/dev/temp/sb-no-addons-wp/node_modules/loader-runner/lib/LoaderRunner.js:205:7
    at /Users/jeppe/dev/temp/sb-no-addons-wp/node_modules/webpack/lib/NormalModule.js:626:20
    at Array.eval (eval at create (/Users/jeppe/dev/temp/sb-no-addons-wp/node_modules/tapable/lib/HookCodeFactory.js:28:14), <anonymous>:12:1)
    at runCallbacks (/Users/jeppe/dev/temp/sb-no-addons-wp/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:18:17)
    at /Users/jeppe/dev/temp/sb-no-addons-wp/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:149:7
    at /Users/jeppe/dev/temp/sb-no-addons-wp/node_modules/graceful-fs/graceful-fs.js:123:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)

WARN Broken build, fix the error above.
WARN You may need to refresh the browser.
blpfk2vs

blpfk2vs1#

any solution?

{
  devDependencies: {
      "@storybook/addon-essentials": "^7.5.0",
      "@storybook/addon-interactions": "^7.5.0",
      "@storybook/addon-links": "^7.5.0",
      "@storybook/addon-onboarding": "^1.0.8",
      "@storybook/blocks": "^7.5.0",
      "@storybook/react": "^7.5.0",
      "@storybook/react-vite": "^7.5.0",
      "@storybook/testing-library": "^0.2.2",  
  }
}
ipakzgxi

ipakzgxi2#

@angeloreis ,我无法从这个信息中判断你的问题是否与此有关。我认为你最好的选择是在Discord上开设一个支持线程。

相关问题