Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unexpected token on "export default const"

I have two different reat-native projects with exactly the same version of libraries.

But the newest one failes on "export default const", the other one not.

What is the difference between both calls?

The first one compiles correctly and is already in the app stores with the following code:

export default const result = [...]

The second one has the same package.json and failes on the same code "unexpected token (1:15) -> the position 15 is after the "default".

This is the used package.json:

{
  "name": "rn_simpleorm",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "react-native start"
  },
  "dependencies": {
    "react": "15.3.2",
    "react-native": "^0.32.0"
  },
  "jest": {
    "preset": "jest-react-native",
    "modulePathIgnorePatterns": [
      "node_modules/react-native/node_modules/"
    ]
  },
  "devDependencies": {
    "babel-jest": "^15.0.0",
    "babel-preset-react-native": "^1.9.0",
    "jest": "^15.1.1",
    "jest-react-native": "^15.0.0",
    "react-test-renderer": "^15.3.1"
  }

}
like image 550
delete Avatar asked Oct 28 '16 20:10

delete


1 Answers

You are exporting a value. const result = isn't a value. What you want is either:

export default [...];

or:

const result = [...];
export default result;
like image 140
Joe Attardi Avatar answered Sep 20 '22 18:09

Joe Attardi