首页 > 解决方案 > React Native,缺少类属性转换

问题描述

当我运行时react-native run-ios,我的应用程序运行正常,但是当我运行时,react-native run-android我收到一条错误消息:

.../node_modules/react-native/Libraries/ART/ReactNativeART.js: Missing class properties transform.

在此处输入图像描述

所以看起来 babel 有问题?

.babelrc的是这样的:

{
  "passPerPreset": true,
  "plugins": [
      "transform-class-properties",
      "transform-inline-environment-variables"
  ],
  "presets": [
      "react-native"
  ]
}

和里面的 babel 包package.json是:

"devDependencies": {
    "babel-eslint": "^8.0.2",
    "babel-plugin-remove-comments": "^2.0.0",
    "babel-plugin-transform-inline-environment-variables": "^0.4.3",
    "babel-preset-react-native": "^4.0.0",
    "babel-jest": "23.0.1",
    "babel-plugin-transform-class-properties": "6.24.1",
  }

有谁知道可能出了什么问题?

标签: react-nativebabeljs

解决方案


推荐阅读