我用expo制作了一个应用程序,但不满意它的大小,我找到了这个博客/辅导老师,了解如何使用react-native init项目来减少它,这是链接:https://medium.com/@aswinmohanme/how-i-reduced-the-size-of-my-react-native-app-by-86-27be72bba640 该博客说:“安装Expo项目的所有依赖项,但Expo特定的库除外。” ,但是由于我使用expo制作了应用程序,因此我使用了expo-av和expo-linear-gradient,它给了我这个错误 错误:捆绑失败:错误:无法从
解析模块@unimodules/core
node_modules/expo-av/build/ExponentAV.js`: @unimodules/core could not be found within the project.
我将expo下载到目录中后,此错误已得到解决,它给了我一个白屏,但是构建成功。
当我删除了与Expo相关的库文件时,它给出了一个错误(当然是..)。
注意:这不是android studio模拟器第一次显示白色屏幕:(,所以我做错了!
这是当前的package.json,除了添加js文件和资产文件夹外,我没有在项目目录中进行任何更改。
{
"name": "fixemulatorBug",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"expo-av": "5.0.2",
"expo-linear-gradient": "~5.0.1",
"react": "16.9.0",
"react-dom": "16.8.3",
"react-native": "0.61.3",
"react-native-drawer": "2.2.2",
"react-native-elements": "1.2.1",
"react-native-gesture-handler": "^1.5.0",
"react-native-reanimated": "^1.4.0",
"react-native-vector-icons": "^6.6.0",
"react-native-web": "0.11.7",
"react-navigation": "4.0.10",
"react-navigation-drawer": "2.2.2",
"react-navigation-stack": "^1.9.4"
},
"devDependencies": {
"@babel/core": "^7.6.4",
"@babel/runtime": "^7.6.3",
"@react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^24.9.0",
"eslint": "^6.6.0",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.57.0",
"react-test-renderer": "16.9.0"
},
"jest": {
"preset": "react-native"
}
}