Support Babel 8 in babelParser (loadPartialConfigSync)
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 冷清
- 技术栈
- react, typescript
- 领域
- tooling
调研方向
从 dist/babelParser.js 中所示的同步 babelParser 路径开始,检查 loadPartialConfig 调用。使用提供的 repro.mjs 和 @babel/core 8.0.1,然后验证在保持与 Babel 7 兼容的同时,使用 Babel 8 解析能够成功。
由索引模型根据 Issue 内容生成。
描述
Description
react-docgen@8.0.3 cannot parse components when its @babel/core dependency is resolved to Babel 8.
babelParser calls loadPartialConfig synchronously. Starting with Babel 8, that API expects a callback; synchronous callers must use loadPartialConfigSync.
This surfaced through Storybook's react-docgen plugin when a workspace-wide override resolved Babel to 8.0.1. Storybook is currently tracking Babel 8 support and explicitly waiting for react-docgen compatibility: https://github.com/storybookjs/storybook/issues/35295
Minimal reproduction
package.json:
{
"private": true,
"type": "module",
"packageManager": "pnpm@11.13.0",
"dependencies": {
"@babel/core": "8.0.1",
"react-docgen": "8.0.3"
}
}
pnpm-workspace.yaml:
packages:
- .
overrides:
'@babel/core': 8.0.1
repro.mjs:
import { parse } from 'react-docgen';
parse('export const Button = ({ label }) => <button>{label}</button>;');
Run:
pnpm install
node repro.mjs
Actual result
Error: Starting from Babel 8.0.0, the 'loadPartialConfig' function expects a callback. If you need to call it synchronously, please use 'loadPartialConfigSync'.
at loadPartialConfig (.../@babel/core/lib/index-shared.js:2207:11)
at buildPluginList (.../react-docgen/dist/babelParser.js:34:27)
Expected result
Parsing succeeds with Babel 8, while retaining Babel 7 compatibility.
Versions
react-docgen: 8.0.3@babel/core: 8.0.1- Node.js: 24.18.0
- pnpm: 11.13.0
The likely compatibility change is to use loadPartialConfigSync for this synchronous code path; that API is also available in Babel 7.
- 主要语言
- TypeScript
- 星标
- 3.8k
- 派生
- 316
- 平均合并
- 5 小时 7 分钟
- 30 天内合并 PR
- 4
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
reactjs/react-docgen 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 58/100
reactjs/react-docgen#1134 ·
-
难度 5/5 一周以上 新手友好度 20/100
reactjs/react-docgen#1005 · 4 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 48/100
reactjs/react-docgen#997 ·
-
难度 3/5 1-2 天 新手友好度 42/100
reactjs/react-docgen#994 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 25/100
reactjs/react-docgen#982 · 2 条评论 ·
查看 reactjs/react-docgen 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
-
area:tools bug good first issue help wanted priority:P2
难度 2/5 1-3 小时 新手友好度 90/100
TaewoooPark/Motifcode#14 ·
-
bug
难度 2/5 1-3 小时 新手友好度 84/100
newrelic-experimental/preflight#793 · 1 条评论 ·
-
bug 🐞
难度 2/5 1-3 小时 新手友好度 68/100
-
[Bounty proposal] fix(web): memory insights count an evening memory on the next day ($25 proposed) 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
BasedHardware/omi#15320 ·