title: Set a custom entry file for Metro dev server in React Native build
body: <p>I'm writing some scripts that do custom React Native builds for unit testing and such, specifying a custom entry file for the <code>react-native-xcode.sh</code> script using the <code>ENTRY_FILE</code> env variable. This is super useful and great. I'm able to do release builds no problem, and they work just fine, so basically I can build a RN app from any entry file at will. However, when I try a <code>Debug</code> variant build, metro doesn't seem to know about my special custom entry file, and gives me this error:</p>
  <pre class="lang-js prettyprint-override"><code>None of these files exist:
    * index(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
    * index/index(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
      at ModuleResolver.resolveDependency (/Users/justin/dev/enmesh/testutilsnative/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:165:15)
      at ResolutionRequest.resolveDependency (/Users/justin/dev/enmesh/testutilsnative/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:52:18)
      at DependencyGraph.resolveDependency (/Users/justin/dev/enmesh/testutilsnative/node_modules/metro/src/node-haste/DependencyGraph.js:285:16)
      at /Users/justin/dev/enmesh/testutilsnative/node_modules/metro/src/lib/transformHelpers.js:267:42
      at Server.&lt;anonymous&gt; (/Users/justin/dev/enmesh/testutilsnative/node_modules/metro/src/Server.js:841:41)
      at Generator.next (&lt;anonymous&gt;)
      at asyncGeneratorStep (/Users/justin/dev/enmesh/testutilsnative/node_modules/metro/src/Server.js:99:24)
      at _next (/Users/justin/dev/enmesh/testutilsnative/node_modules/metro/src/Server.js:119:9)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
  IN RESOLVER
  Error: Unable to resolve module `./index` from ``: 
  </code></pre>
  <p>Does anyone know how I can get the Debug build of the app to interface properly with the Metro development server, so I can debug my app builds better? Any guidance here would be greatly appreciated!</p>
  <p>Metro is just getting launched automatically by the <code>xcodebuild</code> process, which I'm calling like this:</p>
  <pre><code>const args = {
    simulator: device,
    configuration: variant,
    scheme,
    projectPath: xcodeProjectPath,
    device: undefined,
    uuid: undefined,
    packager: true,
    verbose: true,
    port: 8081,
    terminal: undefined,
  };
  
  const xcodebuildSpawnOptionsArgs: any = {
    ...args,
    cwd: folder,
    env: {
      PLATFORM: 'ios',
      ENTRY_FILE: builtEntryFilePath,
    },
  };
  
  const buildProcess = spawn(
    'xcodebuild',
    xcodebuildArgs,
    getProcessOptions(xcodebuildSpawnOptionsArgs),
  );
  </code></pre>