Key error shows internal code frames
未关闭
还没有人认领这个 Issue。
DX
Impact: Regression
LogBox
Needs: Attention
Never gets stale
Tech: Bundler 📦
- 主要语言
- C++
- 星标
- 127k
- 派生
- 25.3k
- 平均合并
- 1 天 23 小时
- 30 天内合并 PR
- 4
描述
Description
In LogBox, when there's a key error from React, the code frame should point to the application code causing the issue, but in 0.73 (and maybe other versions) it points to the react-jsx-runtime:
The fix is to add '/node_modules/react/cjs/react-jsx-runtime.+\\.js', to the config here:
https://github.com/facebook/react-native/blob/main/packages/metro-config/index.js#L15
Really we should probably have all of '/node_modules/react/.+\\.js$', there.
Steps to reproduce
- trigger key error
- open logbox warning
- see wrong code frame
React Native Version
0.73.0
Affected Platforms
Runtime - Android, Runtime - iOS
Output of npx react-native info
No
Stacktrace or Logs
No
Reproducer
No
Screenshots and Videos
Above
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 packages/metro-config/index.js 约第 15 行开始,那里定义了 code-frame 配置。在 LogBox 中复现关键错误,并检查选择的是哪个 React runtime 文件,而不是应用程序源代码。完成的标准是:警告指向应用程序代码,而不是内部的 react-jsx-runtime 文件。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- react, react-native
- 领域
- mobile, tooling
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 45/100