如何在 React Native 中使用 Sentry 自定义 index.js 的位置?
How do I customize the location of index.js with Sentry in React Native?
我们的包入口点位于 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中的构建命令中:
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 答案中看到关于将脚本放在哪里以及如何准确引用它的具体示例。
事实证明,在使用 Bitcode(默认)的 iOS 项目中应该简单地禁用此构建步骤。因此,我们不再需要 运行 自定义构建脚本。
之后我们将使用 Fastlane 上传调试符号。
参考文档:: https://docs.sentry.io/platforms/react-native/#ios-specifics
答案是
export ENTRY_FILE=index.ios.js
在脚本中
我们的包入口点位于 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中的构建命令中:
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 答案中看到关于将脚本放在哪里以及如何准确引用它的具体示例。
事实证明,在使用 Bitcode(默认)的 iOS 项目中应该简单地禁用此构建步骤。因此,我们不再需要 运行 自定义构建脚本。
之后我们将使用 Fastlane 上传调试符号。
参考文档:: https://docs.sentry.io/platforms/react-native/#ios-specifics
答案是
export ENTRY_FILE=index.ios.js
在脚本中