1
votes

I'm using mobx & decorators.

The project runs fine in the simulator via "npm run ios" and it also builds in Xcode without errors.

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."

Here's my 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:

  • "react": "16.2.0",
  • "react-native": "0.52.0",
  • "mobx": "^4.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?

Any info would be much appreciated!

1

1 Answers

0
votes

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.

Fixed up the bable.rc and it now creates an archive.