简体   繁体   English

React-native和Xcode:项目构建但无法创建档案

[英]React-native & Xcode: Project builds but cannot create archive

I'm using mobx & decorators. 我正在使用mobx和装饰器。

The project runs fine in the simulator via "npm run ios" and it also builds in Xcode without errors. 该项目可以通过“ npm run ios”在模拟器中正常运行,并且还可以在Xcode中正确构建。

When I try to create an archive it fails with: 当我尝试创建存档时,它失败并显示:

"SyntaxError in /mobx-stores/UserStore.js: Method has decorators, put the decorator plugin before the classes one." “ /mobx-stores/UserStore.js中的SyntaxError:方法具有装饰器,请将装饰器插件放在类的前面。”

Here's my bable.rc: 这是我的bable.rc:

{
  "presets": [
    "babel-preset-react-native-stage-0/decorator-support",
    "react-native"],
  "env": {
    "development": {
        "plugins": [
           "transform-react-jsx-source", 
           "transform-decoratorslegacy"
        ]
     }
   }
}

Versions in package.json: package.json中的版本:

  • "react": "16.2.0", “ react”:“ 16.2.0”,
  • "react-native": "0.52.0", “ react-native”:“ 0.52.0”,
  • "mobx": "^4.0.1", “ mobx”:“ ^ 4.0.1”,
  • "babel-preset-react-native-stage-0": "^1.0.1", “ babel-preset-react-native-stage-0”:“ ^ 1.0.1”,
  • "babel-preset-react-native-stage-0": "^1.0.1", “ babel-preset-react-native-stage-0”:“ ^ 1.0.1”,

I've tried many work arounds without success. 我已经尝试了许多解决方法,但均未成功。

Bottom line: Is it possible (or advisable) to use decorators in a react-native project used with Xcode? 底线:是否有可能(或建议)在与Xcode一起使用的本机项目中使用装饰器?

Any info would be much appreciated! 任何信息将不胜感激!

Sigh, 叹,

I missed the fact that my bable.rc uses 'env' for plugins and I guess an archive build will not set the 'dev' environment variable. 我错过了我的bable.rc对插件使用'env'的事实,我想一个存档版本将不会设置'dev'环境变量。

Fixed up the bable.rc and it now creates an archive. 修复了bable.rc,现在它创建了一个存档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM