我在响应本机时遇到未引用的错误,为什么呢?我能够成功构建,但捆绑程序显示此错误。我该如何解决?
注意:我正在使用Windows 10
屏幕截图:
package.json:
{
"name": "rchampz",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"lodash": "^4.17.11",
"moment": "^2.22.2",
"react": "16.5.0",
"react-native": "0.57.0",
"react-native-dash": "^0.0.9",
"react-native-dropdownalert": "^3.5.0",
"react-native-material-dropdown": "^0.11.1",
"react-native-modal-datetime-picker": "^6.0.0",
"react-native-paper": "^2.0.1",
"react-native-render-html": "^3.10.0",
"react-native-timeline-theme": "^0.0.9",
"react-native-vector-icons": "^5.0.0",
"react-navigation": "^2.14.2",
"react-redux": "^5.0.7",
"redux": "^4.0.0"
},
"devDependencies": {
"babel-jest": "23.6.0",
"jest": "23.6.0",
"react-test-renderer": "16.5.0"
},
"jest": {
"preset": "react-native"
}
}
.babelrc:
{
"presets": ["module:react-native"]
}
答案 0 :(得分:1)
要么在.bablerc中包含react-native的预设,要么从babel.config.js中导出预设,如下所示:
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [
'@babel/plugin-transform-runtime'
],
}