Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

includeWebFeedback: false leaves @sentry/browser's feedbackSync in bundles made on Windows, which then fail at launch

未关闭 适合新手
#6,913 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
74/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
javascript, react-native, typescript

调研方向

Issue 指出 dist/js/tools/metroconfig.js 中的 isFromSentryBrowser 是原因。阅读该函数和 SENTRY_BROWSER_FEEDBACK_WRAPPER_RE 注释,然后比较 originModulePath 对 Windows 反斜杠和 Unix 斜杠的处理方式。当 includeWebFeedback: false 在 Windows bundle 中为两个浏览器反馈模块都提供 stub,并且 bundle 成功启动时,即为完成。

由索引模型根据 Issue 内容生成。

描述

Bug React-Native Waiting for: Product Owner
Environment
  • @sentry/react-native 8.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
  1. Use getSentryExpoConfig(__dirname, { includeWebFeedback: false }) in metro.config.js.
  2. On Windows, run npx expo export --platform ios --source-maps (or eas update).
  3. 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

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

getsentry/sentry-react-native 的其他 Issue

查看 getsentry/sentry-react-native 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。