welldone-software / why-did-you-render

why-did-you-render by Welldone Software monkey patches React to notify you about potentially avoidable re-renders. (Works with React Native as well.)
https://www.npmjs.com/package/@welldone-software/why-did-you-render
MIT License
11.11k stars 196 forks source link

Property 'React' doesn't exist #291

Closed awilson9 closed 6 months ago

awilson9 commented 6 months ago

Expo project, wdyr worked earlier in this project but now i get the following error

ReferenceError: Property 'React' doesn't exist, js engine: hermes 
    at ContextNavigator (http://192.168.0.86:8081/node_modules/expo-router/entry.bundle//&platform=ios&dev=true&hot=false&lazy=true:153825:24)
    at ExpoRoot (http://192.168.0.86:8081/node_modules/expo-router/entry.bundle//&platform=ios&dev=true&hot=false&lazy=true:153796:30)
    at App
    at withDevTools(App) (http://192.168.0.86:8081/node_modules/expo-router/entry.bundle//&platform=ios&dev=true&hot=false&lazy=true:132029:27)
    at ErrorToastContainer (http://192.168.0.86:8081/node_modules/expo-router/entry.bundle//&platform=ios&dev=true&hot=false&lazy=true:131930:24)
    at ErrorOverlay
    at RCTView
    at View (http://192.168.0.86:8081/node_modules/expo-router/entry.bundle//&platform=ios&dev=true&hot=false&lazy=true:40380:43)
    at RCTView
    at View (http://192.168.0.86:8081/node_modules/expo-router/entry.bundle//&platform=ios&dev=true&hot=false&lazy=true:40380:43)
    at AppContainer (http://192.168.0.86:8081/node_modules/expo-router/entry.bundle//&platform=ios&dev=true&hot=false&lazy=true:40220:36)
    at main(RootComponent) (http://192.168.0.86:8081/node_modules/expo-router/entry.bundle//&platform=ios&dev=true&hot=false&lazy=true:120954:28)

wdyr.ts

const whyDidYouRender = require('@welldone-software/why-did-you-render');

whyDidYouRender(React, {
  trackAllPureComponents: true,
});

package.json

{
  "name": "shady-pines-radio-mobile",
  "main": "expo-router/entry",
  "version": "0.9.0",
  "scripts": {
    "start": "expo start",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web",
    "test": "jest --watchAll",
    "prepare": "patch-package",
    "tsc": "npx tsc --project tsconfig.json"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "@babel/preset-env": "^7.22.10",
    "@expo/metro-runtime": "^2.2.5",
    "@expo/vector-icons": "^13.0.0",
    "@gorhom/bottom-sheet": "^4",
    "@react-native-community/cli": "^11.3.8",
    "@react-native-community/cookies": "^5.0.1",
    "@react-native-firebase/app": "^18.6.1",
    "@react-native-firebase/auth": "^18.6.1",
    "@react-native-firebase/crashlytics": "^18.6.1",
    "@react-native-firebase/perf": "^18.6.1",
    "@react-native-google-signin/google-signin": "^10.0.1",
    "@react-native-masked-view/masked-view": "^0.2.9",
    "@react-native-menu/menu": "^0.9.1",
    "@react-navigation/bottom-tabs": "^6.5.8",
    "@react-navigation/drawer": "^6.6.3",
    "@react-navigation/native": "^6.0.2",
    "@react-navigation/native-stack": "^6.9.13",
    "@react-navigation/stack": "^6.3.17",
    "@reduxjs/toolkit": "^1.9.5",
    "@rneui/themed": "4.0.0-rc.8",
    "axios": "^0.27.2",
    "date-fns": "^2.30.0",
    "date-fns-tz": "^2.0.0",
    "expo": "~49.0.7",
    "expo-apple-authentication": "~6.1.0",
    "expo-build-properties": "^0.8.3",
    "expo-constants": "~14.4.2",
    "expo-crypto": "^12.4.1",
    "expo-dev-client": "2.4.12",
    "expo-font": "~11.4.0",
    "expo-image": "~1.3.5",
    "expo-linking": "~5.0.2",
    "expo-modules-autolinking": "^1.5.1",
    "expo-random": "~13.2.0",
    "expo-router": "2.0.0",
    "expo-splash-screen": "~0.20.5",
    "expo-standard-web-crypto": "^1.7.0",
    "expo-status-bar": "~1.6.0",
    "expo-system-ui": "~2.4.0",
    "expo-web-browser": "~12.3.2",
    "firebase": "^10.6.0",
    "js-sha256": "^0.10.1",
    "lodash": "^4.17.21",
    "metro": "^0.76.7",
    "metro-core": "^0.79.1",
    "onesignal-expo-plugin": "^2.0.2",
    "react": "18.2.0",
    "react-airplay": "^1.2.0",
    "react-dom": "18.2.0",
    "react-native": "0.72.6",
    "react-native-dotenv": "^3.4.9",
    "react-native-fs": "^2.20.0",
    "react-native-gesture-handler": "~2.12.0",
    "react-native-mmkv-storage": "^0.9.1",
    "react-native-onesignal": "^5.0.2",
    "react-native-reanimated": "3.3.0",
    "react-native-safe-area-context": "4.6.3",
    "react-native-screens": "~3.22.0",
    "react-native-svg": "^13.9.0",
    "react-native-svg-transformer": "^1.3.0",
    "react-native-swiper-flatlist": "^3.2.3",
    "react-native-track-player": "^3.2.0",
    "react-native-vector-icons": "^10.0.0",
    "react-native-volume-manager": "^1.10.0",
    "react-native-web": "~0.19.6",
    "react-native-webview": "13.2.2",
    "react-redux": "^8.1.2",
    "zod": "^3.22.4"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0-0",
    "@babel/plugin-proposal-optional-chaining": "^7.21.0",
    "@babel/plugin-transform-arrow-functions": "^7.0.0-0",
    "@babel/plugin-transform-shorthand-properties": "^7.0.0-0",
    "@babel/plugin-transform-template-literals": "^7.0.0-0",
    "@babel/runtime": "^7.22.10",
    "@types/jest": "^29.5.3",
    "@types/lodash": "^4.14.197",
    "@types/react": "~18.2.20",
    "@types/react-test-renderer": "^18.0.0",
    "@types/webpack-env": "^1.18.1",
    "@typescript-eslint/eslint-plugin": "^5.62.0",
    "@typescript-eslint/parser": "^5.62.0",
    "@welldone-software/why-did-you-render": "8.0.1",
    "confusing-browser-globals": "^1.0.11",
    "eas": "^0.1.0",
    "eslint": "^8.47.0",
    "eslint-config-airbnb": "^19.0.4",
    "eslint-config-prettier": "^9.0.0",
    "eslint-import-resolver-alias": "^1.1.2",
    "eslint-import-resolver-node": "^0.3.9",
    "eslint-import-resolver-typescript": "^3.6.0",
    "eslint-plugin-import": "^2.28.0",
    "eslint-plugin-jsx-a11y": "^6.7.1",
    "eslint-plugin-no-date-parsing": "^1.0.1",
    "eslint-plugin-no-relative-import-paths": "^1.5.2",
    "eslint-plugin-prettier": "^5.0.0",
    "eslint-plugin-react": "^7.33.1",
    "eslint-plugin-react-hooks": "^4.3.0",
    "eslint-plugin-react-native": "^4.0.0",
    "eslint-plugin-unused-imports": "^3.0.0",
    "jest": "^29.2.1",
    "jest-expo": "~49.0.0",
    "patch-package": "^8.0.0",
    "postinstall-postinstall": "^2.1.0",
    "prettier": "^3.0.2",
    "react-test-renderer": "18.2.0",
    "typescript": "^5.3.2"
  },
  "overrides": {
    "react-refresh": "~0.14.0"
  },
  "resolutions": {
    "react-refresh": "~0.14.0"
  },
  "private": true,
  "pnpm": {
    "overrides": {
      "semver@>=7.0.0 <7.5.2": ">=7.5.2"
    }
  }
}
awilson9 commented 6 months ago

Sorry sorry sorry. import got removed by eslint rules i am a dummy