myApp/index.js 'loose' mode configuration must be the same for @babel/plugin-proposal-class-properties

Viewed 10

After init React Native 0.70.1 app and upgraded dev dependency a few @babel module and jest, npx react-native run-android succeeded but emulator started to throw error:

BUNDLE  ./index.js 

error: index.js: /Users/macair/Documents/code/js/xyz_app6/index.js: 'loose' mode
configuration must be the same for @babel/plugin-proposal-class-properties,
@babel/plugin-proposal-private-methods and @babel/plugin-proposal-private-property-in-object
(when they are enabled).

Here is the screen shot on android emulator:

enter image description here

Here is the part of package.json:

 "dependencies": {
    "react": "18.1.0",
    "react-native": "0.70.1"
  },
  "devDependencies": {
    "@babel/core": "^7.19.1",
    "@babel/plugin-proposal-private-methods": "^7.18.6",
    "@babel/plugin-transform-flow-strip-types": "^7.19.0",
    "@babel/runtime": "^7.19.0",
    "@react-native-community/eslint-config": "^3.1.0",
    "@testing-library/react-native": "^11.1.0",
    "babel-jest": "^29.0.3",
    "eslint": "^8.23.1",
    "jest": "^29.0.3",
    "metro-react-native-babel-preset": "^0.72.1",
    "react-test-renderer": "18.1.0"
  },
  "jest": {
    "preset": "react-native",
    "cacheDirectory": "./cache",
    "setupFiles": [
      "<rootDir>/jest.setup.js"
    ],
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js",
      "jsx",
      "json",
      "node"
    ],
    "transform": {
      "\\.[jt]sx?$": "babel-jest"
    },
    "transformIgnorePatterns": []
    
  }

The error is related to @babel and jest upgrade. What is really missing here?

0 Answers
Related