* React-Native *-当前未启用对实验语法'decorators-legacy'的支持

时间:2019-06-03 11:19:43

标签: reactjs react-native babel

我目前正在尝试首先将React-Native版本从0.55.3升级到0.57.0

但是我目前在.babelrc配置上遇到问题,我想... 我遇到此错误:

Failed to load bundle with error: Support for 
the experimental syntax 'decorators-legacy' 
isn't currently enabled (78:1):

这里是发生错误的文件,但这是语法错误,可能是因为我忘记了一些东西...

@connectActionSheet
     | ^
     | class MyClass extends Component<*, Props, State> {}

我的旧.babelrc文件

{
  "presets": [
    "react-native",
    "react-native-stage-0/decorator-support"
  ],
  "ignore": "false",
  "env": {
    "development": {
      "sourceMaps": "inline"
    }
  },
  "plugins": [
    "syntax-class-properties",
    "transform-class-properties",
    "transform-object-rest-spread",
    "lodash",
    [
      "module-resolver",
      {
        "root": [
          "./App"
        ],
        "alias": {
          "~": "./App"
        }
      }
    ]
  ]
}

我的新人:

{
  "presets": [
    "module:metro-react-native-babel-preset"
  ],
  "env": {
    "development": {
      "sourceMaps": "inline"
    }
  },
  "plugins": [
    "syntax-class-properties",
    "transform-class-properties",
    "transform-object-rest-spread",
    "lodash",
    [
      "module-resolver",
      {
        "root": [
          "./App"
        ],
        "alias": {
          "~": "./App"
        }
      }
    ]
  ]
}

0 个答案:

没有答案