If you want to rely on local packages, there are two possible methods.
There are many ways to obtain it, using the npm pack
command to package it is quite common.
In the package.json
file, modify the dependencies:
{
// ... other configurations
"dependencies": {
// ... other dependencies
// "react-native-agora-chat": "1.3.0-beta.0", // Remote dependency method
// "react-native-agora-chat": "/Users/asterisk/Codes/rn/react-native-agora-chat-1.3.0-beta.0" // Local dependency method.
"react-native-agora-chat": "link:../../react-native-agora-chat-1.3.0-beta.0" // Both relative and absolute paths are acceptable.
}
}
In the metro.config.js
file, add the following content:
module.exports = {
// ... other configurations
watchFolders: [
// ... other directories
'/Users/asterisk/Codes/rn/react-native-agora-chat-1.3.0-beta.0', // uikit npm local directory
],
resolver: {
// ... other configurations
nodeModulesPaths: [
// ... other directories
'/Users/asterisk/Codes/rn/react-native-chat-library-2.0/node_modules', // Dependencies needed by uikit itself. The node_modules directory in the current repo root.
],
},
};
After modifying the metro.config.js
file, you need to restart the service for the changes to take effect.
This method is simple, you only need to modify the package.json
configuration directly.
{
// ... other configurations
"dependencies": {
// ... other dependencies
"react-native-agora-chat": "/Users/asterisk/Codes/rn/react-native-agora-chat-1.3.0-beta.0" // Local dependency method.
}
}