【问题标题】:How do I customize the location of index.js with Sentry in React Native?如何在 React Native 中使用 Sentry 自定义 index.js 的位置?
【发布时间】:2021-01-05 14:15:39
【问题描述】:

我们的 bundle 入口点位于 src/index.tsx,这似乎与 ./index.js 的 Sentry 默认值不匹配。

Sentry 在 sentry-cli react-native-xcode 上失败,错误为 EOF while parsing a value at line 1 column 0

使用调试日志级别,我看到了:

+ ENTRY_FILE=index.js
...
Error: The resource `/Users/lukecwilliams/Projects/mobile2mr/index.js` was not found.

在实际的 CLI 命令中,正在运行:--entry-file index.js

我们需要--entry-file src/index.tsx。我们如何定制这个?我在文档或源代码中找不到答案。


我找到了this solution(自定义构建脚本),但它仍然无法正常工作。

我在项目根目录中有一个脚本:

sentry-cli-xcode-build.sh:

./node_modules/react-native/packager/react-native-xcode.sh ./src/index.tsx

并且在project.pbxproj的build命令中:

shellScript = "export SENTRY_PROPERTIES=sentry.properties\nexport EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"\nexport NODE_BINARY=node\n../node_modules/@sentry/cli/bin/sentry-cli react-native xcode ../sentry-cli-xcode-build.sh";

但结果相当模棱两可:error: Permission denied (os error 13)

我需要以某种方式更改目录设置吗?我在 Sentry 文档或上面的 GH 答案中没有看到关于将脚本放在哪里以及如何准确引用它的具体示例。

【问题讨论】:

    标签: react-native sentry


    【解决方案1】:

    事实证明,这个构建步骤应该在 iOS 项目中使用 Bitcode(这是默认设置)简单地禁用。因此,我们不再需要运行自定义构建脚本。

    之后我们将使用 Fastlane 上传调试符号。

    参考文档::https://docs.sentry.io/platforms/react-native/#ios-specifics

    【讨论】:

      【解决方案2】:

      答案是

      export ENTRY_FILE=index.ios.js
      

      在脚本中

      【讨论】:

        猜你喜欢
        • 2021-01-13
        • 2019-09-25
        • 2018-02-18
        • 1970-01-01
        • 2018-03-28
        • 1970-01-01
        • 2016-05-10
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多