英文:
@sentry/react-native with react-native-web -- ErrorUtils is not defined
问题
我正在尝试在一个使用 React Native Web 的项目中使用 @sentry/react-native。
React Native Web 似乎没有定义 ErrorUtils,根据我的了解,这是一个 React Native 的函数。这很不幸,因为据我观察,@sentry/react-native 似乎依赖于它。当我尝试使用它时,以下错误输出显示了这一点:
node_modules/@sentry/react-native/dist/js/integrations/reactnativeerrorhandlers.js
Uncaught ReferenceError: ErrorUtils is not defined
at ReactNativeErrorHandlers._handleOnError (reactnativeerrorhandlers.ts:169:9)
at ReactNativeErrorHandlers.setupOnce (reactnativeerrorhandlers.ts:52:10)
那么,在 Sentry 尝试使用这些必要函数之前,我是否有办法在某种程度上替换这些函数,或者有解决这个问题的一些变通方法?还是我必须使用 Sentry 的 JavaScript SDK 在 Web 上使用 platform.select
或类似的方法?
英文:
I'm trying to use @sentry/react-native in a project that uses React Native Web.
React Native Web seems to not define ErrorUtils, which from what I gather is a React Native function. This is unfortunate as @sentry/react-native seems to depend on it, from what I can tell from the following error output when I try to use it:
node_modules/@sentry/react-native/dist/js/integrations/reactnativeerrorhandlers.js
Uncaught ReferenceError: ErrorUtils is not defined
at ReactNativeErrorHandlers._handleOnError (reactnativeerrorhandlers.ts:169:9)
at ReactNativeErrorHandlers.setupOnce (reactnativeerrorhandlers.ts:52:10)
So is there any way for me to somehow swap out the necessary functions before Sentry tries to use them, or some workaround to this issue, or will I have to use the Sentry JS SDK on the web with a platform.select
or something?
答案1
得分: 0
> 这在#2808中已修复。4.14.1版本将于今天稍后发布(2023年2月16日)。请注意,react-native-web不受官方支持。您需要将GlohalHandlers和TryCatch添加到集成中以获取Web错误。
英文:
This was kindly answered on the Sentry Github
> This was fixed in #2808. Release 4.14.1 is coming later today (16 Feb 2023). Note that react-native-web is not officially supported. You will need to add GlohalHandlers and TryCatch to the integrations to get web errors.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论