Reputation: 1958
I'm creating a react-native library that needs some of react-native modules in order to work. Should I mention react-native as a dependency for my project in package.json dependencies?
I saw some other react-native npm packages which mentioned react-native as devDependencies. why they do that?
Upvotes: 2
Views: 266
Reputation: 5070
If it's required for the app to work, you should specify it as a dependency in your package.json.
If it's required, but the user will always have react-native available (e.g. if your library is being used as part of a larger react-native project) you can set it in peerDependencies. This means your app needs it to work, but it doesn't automatically bundle react-native with your code.
Upvotes: 4