将@sentry/react-native与react-native-web一起使用--未定义ErrorUtils

lb3vh1jj  于 2023-02-19  发布在  React
关注(0)|答案(1)|浏览(120)

我尝试在使用React Native Web的项目中使用@sentry/react-native。
React Native Web seems to not define 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尝试使用它们之前,我有没有办法以某种方式交换掉必要的函数,或者解决这个问题的一些方法,或者我必须在Web上使用Sentry JS SDK和platform.select之类的东西?

rkue9o1l

rkue9o1l1#

这个问题在哨兵Github上得到了友好的回答
此问题已在#2808中得到修复。4.14.1版本将于今天晚些时候(2023年2月16日)发布。请注意,react-native-web不受官方支持。您需要将GlohalHandlers和TryCatch添加到集成中,以获取web错误。

相关问题