我一直在尝试将React本机库(本地库)包含到React Native应用中。
所以我用
安装了它npm安装库路径
然后我跑
npm链接库名
我可以在mainProject的node_modules中看到该包。另外,在package.json中,我可以看到依赖项:
"dependencies": {
"react": "16.13.1",
"react-native": "0.63.2",
"react-native-first-library": "file:../react-native-first-library",
"react-native-toast-message": "^1.3.3",
"react-native-webview": "^10.8.3"
},
react-native-first-library是我的react模块。
我做完
- 清除守望者手表:守望者全部手表
- 删除node_modules:rm -rf node_modules并运行yarn install
- 重置Metro的缓存:yarn start --reset-cache
- 删除缓存:rm -rf / tmp / metro-*
但是仍然无法正常工作。我不知道为什么这些事情如此复杂。
答案 0 :(得分:0)
我必须集成一次自定义库。我只是在根目录 customLibs 中创建了一个文件夹,然后将库的文件夹放入其中。然后在package.json中,我指定了mydomain.com/api
我不确定,但是在您的package.json中,路径不应为module.exports = configure(function(ctx) {
return {
// Other configure options
// Full list of options: https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-devServer
devServer: {
https: false,
port: 8080,
open: true, // opens browser window automatically
proxy: [
{
context: ['/sanctum', '/login', '/password', '/logout', '/api'],
target: 'http://192.168.10.10', // Laravel Homestead end-point
// avoid problems with session and XSRF cookies
// When using capacitor, use the IP of the dev server streaming the app
// For SPA and PWA use localhost, given that the app is streamed on that host
// xxx address is the IP address chosen by Quasar to stream the app
cookieDomainRewrite:
ctx.modeName === 'capacitor' ? 'xxx.xxx.xxx.xxx' : 'localhost'
}
]
},
}
});
有两个点,但肯定有一个点。
最后只是"myLib": "file:./customLibs/myLib"
或file:../react-native-first-library