includeWebFeedback: false leaves @sentry/browser's feedbackSync in bundles made on Windows, which then fail at launch
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 74/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript, react-native, typescript
- 领域
- build-system, tooling
调研方向
Issue 指出 dist/js/tools/metroconfig.js 中的 isFromSentryBrowser 是原因。阅读该函数和 SENTRY_BROWSER_FEEDBACK_WRAPPER_RE 注释,然后比较 originModulePath 对 Windows 反斜杠和 Unix 斜杠的处理方式。当 includeWebFeedback: false 在 Windows bundle 中为两个浏览器反馈模块都提供 stub,并且 bundle 成功启动时,即为完成。
由索引模型根据 Issue 内容生成。
描述
Environment
@sentry/react-native8.29.0 (the same code is in 8.31.0)- Expo SDK 57, React Native 0.86.3, Metro via
getSentryExpoConfig - Bundled on Windows 11 (
eas update, which bundles locally)
Steps to reproduce
- Use
getSentryExpoConfig(__dirname, { includeWebFeedback: false })inmetro.config.js. - On Windows, run
npx expo export --platform ios --source-maps(oreas update). - List the bundle's source map
sources.
Expected result
As on macOS and Linux: @sentry/feedback is stubbed, and so are @sentry/browser's feedbackSync.js and feedbackAsync.js, as the comment above SENTRY_BROWSER_FEEDBACK_WRAPPER_RE describes.
Actual result
@sentry/feedback is stubbed, but @sentry/browser/build/npm/esm/prod/feedbackSync.js and feedbackAsync.js are bundled. feedbackSync.js calls buildFeedbackIntegration() from the empty module as it loads, so the bundle fails at launch. On an expo-updates update, the phone records a failed launch and falls back to its embedded bundle.
The cause is isFromSentryBrowser in dist/js/tools/metroconfig.js:
function isFromSentryBrowser(originModulePath) {
return originModulePath.includes('@sentry/browser');
}
On Windows, Metro's context.originModulePath uses backslashes (...\node_modules\@sentry\browser\build\...), so this is never true. Matching either separator fixes it, for example /[\/]@sentry[\/]browser[\/]/.test(originModulePath).
Our workaround is to wrap config.resolver.resolveRequest after getSentryExpoConfig and return { type: 'empty' } for /\/feedback(Sync|Async)/ requested from a path matching that pattern.
- 主要语言
- TypeScript
- 星标
- 1.8k
- 派生
- 372
- 平均合并
- 1 天 2 小时
- 30 天内合并 PR
- 105
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
getsentry/sentry-react-native 的其他 Issue
-
React-Native Replays Task
难度 2/5 1-3 小时 新手友好度 88/100
getsentry/sentry-react-native#6680 · 1 条评论 ·
维护者通常 1 天内回复
-
Improvement React-Native
难度 2/5 1-3 小时 新手友好度 68/100
getsentry/sentry-react-native#6143 · 2 条评论 ·
维护者通常 1 天内回复
-
React-Native Task User Feedbacks
难度 2/5 1-3 小时 新手友好度 84/100
getsentry/sentry-react-native#5932 · 2 条评论 ·
维护者通常 1 天内回复
-
React-Native Replays Task
难度 2/5 1-3 小时 新手友好度 65/100
getsentry/sentry-react-native#5882 · 1 条评论 ·
维护者通常 1 天内回复
-
Good First Issue React-Native Task
难度 1/5 1 小时以内 新手友好度 65/100
getsentry/sentry-react-native#5771 · 1 条评论 ·
维护者通常 1 天内回复
查看 getsentry/sentry-react-native 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
logancyang/obsidian-copilot#3753 ·
维护者通常 1 天内回复
-
area: presentation severity: important
难度 2/5 1-3 小时 新手友好度 85/100
voithos-labs/aragonite#763 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
diegosouzapw/OmniRoute#17386 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 半天 新手友好度 72/100
super-productivity/super-productivity#10982 · 1 条评论 ·
维护者通常 1 天内回复