expo / sentry-expo

MIT License
202 stars 83 forks source link

Fix react native web builds #341

Closed krystofwoldrich closed 1 year ago

krystofwoldrich commented 1 year ago

Checklist

Why

fixes: https://github.com/expo/sentry-expo/issues/340

How

The RN SDK version import was moved to sentry.ts so it's not imported for RN Web builds. At the moment importing @sentry/react-native in the RN Web build causes in to crash. This should be fixed in the native package, but for now this PR unblocks sentry-expo to work.

Test Plan

I've tested this with my sample app https://github.com/krystofwoldrich/sentry-expo-sample-app

elenitaex5 commented 1 year ago

Is it fixed in any release? I've tried so many after this one. I've tried 6.2.0 , 6.2.2, 7.0.X but problem still there. I've tried also new sentry-react-native which has expo support, but still face same error.

krystofwoldrich commented 10 months ago

@elenitaex5 This should work in 6.2.1 and newer.

Could you provide a minimal reproducible example?

Timadigwe commented 8 months ago

Hi I'm facing same issue over here , I've tried using the specified versions still doesn't work

Timadigwe commented 8 months ago

This is my dependencies in package.json "dependencies": { "@expo/webpack-config": "^18.0.1", "@firebase/firestore": "^4.1.0", "@portal-payments/solana-wallet-names": "^2.1.0", "@react-native-async-storage/async-storage": "1.17.11", "@react-native-community/art": "^1.2.0", "@react-native-material/core": "^1.3.7", "@react-navigation/bottom-tabs": "^6.5.9", "@react-navigation/native": "^6.1.7", "@react-navigation/native-stack": "^6.9.14", "@react-navigation/stack": "^6.3.17", "@reduxjs/toolkit": "^1.9.5", "@rneui/base": "^4.0.0-rc.7", "@rneui/themed": "^4.0.0-rc.7", "@sentry/react-native": "4.15.2", "@solana-mobile/mobile-wallet-adapter-protocol": "^2.0.1", "@solana/spl-token": "^0.3.8", "@solana/spl-token-registry": "^0.2.4574", "@solana/web3.js": "^1.78.0", "@splitwave/js": "^0.1.6", "await-lock": "^2.2.2", "bn.js": "^5.2.1", "bs58": "^5.0.0", "buffer": "^6.0.3", "d3-shape": "^3.2.0", "expo": "~48.0.18", "expo-application": "~5.1.1", "expo-barcode-scanner": "~12.3.2", "expo-blur": "~12.2.2", "expo-constants": "~14.2.1", "expo-dev-client": "~2.2.1", "expo-device": "~5.2.1", "expo-font": "~11.1.1", "expo-image": "~1.0.1", "expo-linear-gradient": "~12.1.2", "expo-linking": "4.0.1", "expo-status-bar": "~1.4.4", "expo-updates": "~0.16.4", "fetch-unfucked": "^1.2.8", "firebase": "^10.1.0", "formik": "^2.4.2", "moment-timezone": "^0.5.43", "react": "18.2.0", "react-dom": "18.2.0", "react-native": "0.71.13", "react-native-device-info": "^10.8.0", "react-native-elements": "^3.4.3", "react-native-gesture-handler": "~2.9.0", "react-native-get-random-values": "~1.9.0", "react-native-keychain": "^8.1.1", "react-native-safe-area-context": "4.5.0", "react-native-screens": "~3.20.0", "react-native-shadow-2": "^7.0.8", "react-native-skeleton-content": "^1.0.28", "react-native-svg": "13.4.0", "react-native-svg-charts": "^5.4.0", "react-native-svg-uri": "^1.2.3", "react-native-url-polyfill": "^2.0.0", "react-native-vector-icons": "^10.0.0", "react-native-web": "~0.18.10", "react-navigation": "^4.4.4", "react-navigation-stack": "^2.10.4", "react-navigation-tabs": "^2.11.2", "react-query": "^3.39.3", "react-redux": "^8.1.1", "sentry-expo": "~6.2.0", "text-encoding-polyfill": "^0.6.7", "tweetnacl": "^1.0.3" },

krystofwoldrich commented 7 months ago

Hi @Timadigwe, @sentry/react-native now supports Expo out of the box including react-native-web!

Update to https://github.com/getsentry/sentry-react-native/releases/tag/5.16.0 or newer to get all the new features.

Migration guides available: