我正在尝试构建一个heroku应用程序,但是当我运行该应用程序时,我在控制台中收到以下错误消息:
import {AppRegistry} from 'react-native';
^^^^^^
SyntaxError: Unexpected token import
从我在网上阅读的内容来看,似乎是Babel / Jest问题?不确定,但任何帮助将不胜感激。
这是我的index.js文件:
import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';
AppRegistry.registerComponent(appName, () => App);
这是我的package.json文件:
{
"name": "rnTutorial",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"react": "16.8.6",
"react-native": "0.60.3",
"prop-types": "^15.7.2",
"react-native-router-flux": "^4.0.6",
"react-redux": "^7.1.0",
"redux": "^4.0.1",
"redux-form": "^8.2.4",
"redux-persist": "^5.6.12",
"redux-thunk": "^2.3.0"
},
"devDependencies": {
"@babel/core": "^7.5.4",
"@babel/runtime": "^7.5.4",
"@react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^24.8.0",
"eslint": "^6.0.1",
"jest": "^24.8.0",
"metro-react-native-babel-preset": "^0.55.0",
"react-test-renderer": "16.8.6"
},
"jest": {
"preset": "react-native"
}
}