module.exports = {
  plugins: [
    [require('babel-plugin-dotenv'), {
      replacedModuleName: 'react-native-dotenv'
    }],
  ],
};

var config = require("react-native/packager/rn-cli.config");

module.exports = {
  plugins: [
    [require('babel-plugin-dotenv'), {
      replacedModuleName: 'react-native-dotenv',
      configDir: config.getProjectRoots()[0]
    }],
  ],
};

Use RN’s projectRoots resolver to set the correct configDir
Use RN’s projectRoots resolver to set the correct configDir
