react-native "Export statement may only appear at top level" 在清理项目之前工作正常我如何找出问题?
react-native "Export statement may only appear at top level" was working fine until cleaning project how do I find out the issue?
我只在网上看到有关此消息的 babelrc 等方面的更改。我试图删除给我这个错误的依赖项,然后下一个依赖项似乎评估了 returns 相同的消息。
错误来自我的 node_modules 文件夹的 any/all,代码是正确的。我猜我的开发依赖项中的某个版本发生了变化,但不确定如何追踪它...
我使用的是我知道的 RN 61.5,但这是一个生产环境,无法更新 atm。请提供有关在哪里查找问题的帮助?
"dependencies": {
"@nartc/react-native-barcode-mask": "1.1.5",
"@react-native-community/async-storage": "1.7.1",
"@react-native-community/masked-view": "0.1.5",
"@react-native-community/netinfo": "6.0.2",
"@react-native-community/picker": "1.6.5",
"@reduxjs/toolkit": "1.2.3",
"clone": "2.1.2",
"expo-keep-awake": "8.0.0",
"expo-linear-gradient": "8.0.0",
"lodash": "4.17.19",
"moment": "2.24.0",
"react": "16.9.0",
"react-native": "0.61.5",
"react-native-ble-manager": "git+https:/react-native-ble-manager.git#mergeUpstreamv750",
"react-native-camera": "3.15.1",
"react-native-date-picker": "2.7.12",
"react-native-device-battery": "2.0.0",
"react-native-device-info": "5.5.1",
"react-native-elements": "^3.4.2",
"react-native-exception-handler": "^2.10.10",
"react-native-fs": "2.16.4",
"react-native-gesture-handler": "1.5.3",
"react-native-json-tree": "^1.3.0",
"react-native-lock-task": "1.0.8",
"react-native-masked-text": "1.13.0",
"react-native-modal": "11.5.4",
"react-native-reanimated": "1.4.0",
"react-native-restart": "0.0.17",
"react-native-safe-area-context": "0.6.2",
"react-native-screens": "2.0.0-alpha.23",
"react-native-svg": "12.0.3",
"react-native-unimodules": "0.7.0",
"react-native-vector-icons": "6.6.0",
"react-native-version-number": "0.3.6",
"react-navigation": "4.1.1",
"react-navigation-animated-switch": "0.5.5",
"react-navigation-header-buttons": "3.0.5",
"react-navigation-hooks": "1.1.0",
"react-navigation-stack": "2.0.13",
"react-redux": "7.1.3",
"redux": "4.0.5",
"redux-saga": "1.1.3",
"redux-storage": "4.1.2",
"redux-storage-engine-reactnativeasyncstorage": "1.0.7",
"reselect": "4.0.0",
"sedcommon": "git+https://sedcommon.git#p2.3.6",
"semver": "7.3.2",
"socket.io-client": "4.1.3",
"styled-components": "5.0.0",
"ts-optchain": "0.1.8"
},
"devDependencies": {
"@babel/core": "^7.7.7",
"@babel/runtime": "^7.7.7",
"@carimus/metro-symlinked-deps": "^1.1.0",
"@react-native-community/eslint-config": "^0.0.6",
"@types/jest": "~26.0.13",
"@types/lodash": "^4.14.153",
"@types/node": "^14.0.6",
"@types/react": "^16.9.17",
"@types/react-native": "^0.60.30",
"@types/react-navigation": "^3.4.0",
"@types/react-redux": "^7.1.7",
"@types/react-test-renderer": "^16.9.1",
"@types/socket.io": "^2.1.4",
"@types/styled-components": "^4.4.2",
"@typescript-eslint/eslint-plugin": "^2.26.0",
"@typescript-eslint/parser": "^2.26.0",
"apk-parser": "^0.1.7",
"babel-jest": "^24.9.0",
"babel-plugin-dynamic-import-node": "^2.3.0",
"babel-plugin-module-resolver": "^4.0.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.19.0",
"husky": "^4.2.3",
"jest": "^26.4.2",
"js-yaml": "^4.1.0",
"jshint": "^2.11.0-rc1",
"metro-react-native-babel-preset": "^0.56.4",
"node-apk-parser": "^0.2.3",
"prettier": "^2.0.5",
"prettier-eslint": "^9.0.1",
"react-native-typescript-transformer": "^1.2.13",
"react-test-renderer": "16.9.0",
"redux-devtools-extension": "^2.13.8",
"redux-perf-middleware": "1.2.2",
"simple-git": "^2.44.0",
"ts-jest": "^26.3.0",
"ts-node": "^10.2.0",
"typescript": "^4.4.4"
},
我现在的babel.conig.js
module.exports = (api) => {
api.cache.using(() => process.env.NODE_ENV);
const presets = ['module:metro-react-native-babel-preset'];
const plugins = [
['dynamic-import-node'],
[
'module-resolver',
{
root: ['./src'],
extensions: ['.js', '.ts', '.tsx', '.ios.js', '.android.js'],
alias: {
// when changed here also change in tsconfig.json
actions: './src/actions',
components: './src/components',
constants: './src/constants',
images: './src/images',
lib: './src/lib',
reducers: './src/reducers',
sagas: './src/sagas',
screens: './src/screens',
utils: './src/utils',
types: './src/types',
},
},
],
];
return {
presets,
plugins,
};
};
我们决定冒险一试。将项目从 rn 61.5 升级到 67!只用了 2 天 ;) 希望我们能从那里开始...
我只在网上看到有关此消息的 babelrc 等方面的更改。我试图删除给我这个错误的依赖项,然后下一个依赖项似乎评估了 returns 相同的消息。
错误来自我的 node_modules 文件夹的 any/all,代码是正确的。我猜我的开发依赖项中的某个版本发生了变化,但不确定如何追踪它...
我使用的是我知道的 RN 61.5,但这是一个生产环境,无法更新 atm。请提供有关在哪里查找问题的帮助?
"dependencies": {
"@nartc/react-native-barcode-mask": "1.1.5",
"@react-native-community/async-storage": "1.7.1",
"@react-native-community/masked-view": "0.1.5",
"@react-native-community/netinfo": "6.0.2",
"@react-native-community/picker": "1.6.5",
"@reduxjs/toolkit": "1.2.3",
"clone": "2.1.2",
"expo-keep-awake": "8.0.0",
"expo-linear-gradient": "8.0.0",
"lodash": "4.17.19",
"moment": "2.24.0",
"react": "16.9.0",
"react-native": "0.61.5",
"react-native-ble-manager": "git+https:/react-native-ble-manager.git#mergeUpstreamv750",
"react-native-camera": "3.15.1",
"react-native-date-picker": "2.7.12",
"react-native-device-battery": "2.0.0",
"react-native-device-info": "5.5.1",
"react-native-elements": "^3.4.2",
"react-native-exception-handler": "^2.10.10",
"react-native-fs": "2.16.4",
"react-native-gesture-handler": "1.5.3",
"react-native-json-tree": "^1.3.0",
"react-native-lock-task": "1.0.8",
"react-native-masked-text": "1.13.0",
"react-native-modal": "11.5.4",
"react-native-reanimated": "1.4.0",
"react-native-restart": "0.0.17",
"react-native-safe-area-context": "0.6.2",
"react-native-screens": "2.0.0-alpha.23",
"react-native-svg": "12.0.3",
"react-native-unimodules": "0.7.0",
"react-native-vector-icons": "6.6.0",
"react-native-version-number": "0.3.6",
"react-navigation": "4.1.1",
"react-navigation-animated-switch": "0.5.5",
"react-navigation-header-buttons": "3.0.5",
"react-navigation-hooks": "1.1.0",
"react-navigation-stack": "2.0.13",
"react-redux": "7.1.3",
"redux": "4.0.5",
"redux-saga": "1.1.3",
"redux-storage": "4.1.2",
"redux-storage-engine-reactnativeasyncstorage": "1.0.7",
"reselect": "4.0.0",
"sedcommon": "git+https://sedcommon.git#p2.3.6",
"semver": "7.3.2",
"socket.io-client": "4.1.3",
"styled-components": "5.0.0",
"ts-optchain": "0.1.8"
},
"devDependencies": {
"@babel/core": "^7.7.7",
"@babel/runtime": "^7.7.7",
"@carimus/metro-symlinked-deps": "^1.1.0",
"@react-native-community/eslint-config": "^0.0.6",
"@types/jest": "~26.0.13",
"@types/lodash": "^4.14.153",
"@types/node": "^14.0.6",
"@types/react": "^16.9.17",
"@types/react-native": "^0.60.30",
"@types/react-navigation": "^3.4.0",
"@types/react-redux": "^7.1.7",
"@types/react-test-renderer": "^16.9.1",
"@types/socket.io": "^2.1.4",
"@types/styled-components": "^4.4.2",
"@typescript-eslint/eslint-plugin": "^2.26.0",
"@typescript-eslint/parser": "^2.26.0",
"apk-parser": "^0.1.7",
"babel-jest": "^24.9.0",
"babel-plugin-dynamic-import-node": "^2.3.0",
"babel-plugin-module-resolver": "^4.0.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.19.0",
"husky": "^4.2.3",
"jest": "^26.4.2",
"js-yaml": "^4.1.0",
"jshint": "^2.11.0-rc1",
"metro-react-native-babel-preset": "^0.56.4",
"node-apk-parser": "^0.2.3",
"prettier": "^2.0.5",
"prettier-eslint": "^9.0.1",
"react-native-typescript-transformer": "^1.2.13",
"react-test-renderer": "16.9.0",
"redux-devtools-extension": "^2.13.8",
"redux-perf-middleware": "1.2.2",
"simple-git": "^2.44.0",
"ts-jest": "^26.3.0",
"ts-node": "^10.2.0",
"typescript": "^4.4.4"
},
我现在的babel.conig.js
module.exports = (api) => {
api.cache.using(() => process.env.NODE_ENV);
const presets = ['module:metro-react-native-babel-preset'];
const plugins = [
['dynamic-import-node'],
[
'module-resolver',
{
root: ['./src'],
extensions: ['.js', '.ts', '.tsx', '.ios.js', '.android.js'],
alias: {
// when changed here also change in tsconfig.json
actions: './src/actions',
components: './src/components',
constants: './src/constants',
images: './src/images',
lib: './src/lib',
reducers: './src/reducers',
sagas: './src/sagas',
screens: './src/screens',
utils: './src/utils',
types: './src/types',
},
},
],
];
return {
presets,
plugins,
};
};
我们决定冒险一试。将项目从 rn 61.5 升级到 67!只用了 2 天 ;) 希望我们能从那里开始...