0
  • I have 3 environments development, testing, production in my React Native app
    • Android is managed by flavours + buildTypes
    • iOS is managed by different schema + configurations
  • I have a library that serves only testing purposes (sending info about testing sessions like device ids, user names, video recording etc.)
  • I don't use this in production at all, it should be only an internal thing
  • I manage that now by if-else + .env, but...

I don't want that (potentially risky if misconfigured) library to be in the production build at all. I want to completely exclude it.

How do you manage that for Android and iOS builds? Any tips and tricks are welcome.

I tried to add react-native.config.js as described in documentation react-native-community dependencies, but then the error Library not found was raised.

module.exports = {
  'my-library-name': {
    platforms: {
      ios: {
        configurations: ['testing'],
      },
      android: {
        buildTypes: ['testingRelease'],
      },
    },
  },
}

Babu
  • 4,324
  • 6
  • 41
  • 60
  • is it helpful https://stackoverflow.com/questions/62037022/react-native-0-60-exclude-library-from-autolink? – Kirill Novikov Jan 12 '23 at 20:44
  • hmhm...not sure how to apply this to only some specific build type...maybe here: https://github.com/react-native-community/cli/blob/main/docs/dependencies.md – Babu Jan 13 '23 at 12:24

0 Answers0