***After upgrading react native 0.55 to 0.57.5 throwing error.****
index.android.js: .plugins[0][1] must be an object, false, or undefined
Error: .plugins[0][1] must be an object, false, or undefined
at assertPluginItem (D:\wamp64\www\js\fit\Fitspot-react\mobile\node_modules\
@babel\core\lib\config\validation\option-assertions.js:244:15)
这是我的.babelrc { “预设”:[ “模块:metro-react-native-babel预设”, “ react-native-stage-0” ], “插件”:[ [ “转换定义”, “ scripts / defines.js” ] ] }
package.json
"engines": {
"node": ">=6",
"npm": ">=5"
},"dependencies": {
"@babel/core": "^7.1.6",
"@babel/preset-env": "^7.1.6",
"@babel/preset-react": "^7.0.0",
"analytics-react-native": "1.2.0",
"babel-preset-env": "^7.0.0-beta.3",
"react": "16.6.3",
"react-native": "^0.57.5",
...
},"devDependencies": {
"@babel/plugin-external-helpers": "^7.0.0",
"@babel/plugin-transform-runtime": "7.0.0",
"@babel/preset-env": "^7.1.6",
"babel-core": "7.0.0-bridge.0",
.....
}`
defines.js
const process = require('process');
const NODE_ENV = process.env.NODE_ENV;
let SERVER_ENV = process.env.SERVER_ENV || 'development';
if (NODE_ENV === 'production') {
SERVER_ENV = 'production';
}
module.exports = {
'env.configFilename': '@config/config.' + SERVER_ENV
};
将本机0.55升级到0.57.5后,出现此错误。另外,更新其依赖关系babel7。看来babel 7升级引起了问题,但我无法解决此问题。