lib/getReactNativeExternals.js
function getReactNativeDependencyNames(options) {
  const blacklist = require('react-native/packager/blacklist');
  const ReactPackager = require('react-native/packager/react-packager');
  const rnEntryPoint = require.resolve('react-native');

  return ReactPackager.getDependencies({
    blacklistRE: blacklist(false /* don't blacklist any platform */),
    projectRoots: options.projectRoots,
    assetRoots: options.assetRoots,
    transformModulePath: require.resolve('react-native/packager/transformer'),
  }, {
    entryFile: rnEntryPoint,
    dev: true,
    platform: options.platform,
  }).then(dependencies =>
    dependencies.filter(dependency => !dependency.isPolyfill())
  ).then(dependencies =>
    Promise.all(dependencies.map(dependency => dependency.getName()))
  );
}
function getReactNativeDependencyNames(options) {
  const blacklist = require('react-native/packager/blacklist');
  const ReactPackager = require('react-native/packager/react-packager');
  const rnEntryPoint = require.resolve('react-native');

  return ReactPackager.getDependencies({
    blacklistRE: blacklist(false /* don't blacklist any platform */),
    projectRoots: options.projectRoots,
    assetRoots: options.assetRoots,
    transformModulePath: require.resolve('react-native/packager/transformer'),
  }, {
    entryFile: rnEntryPoint,
    dev: true,
    platform: options.platform,
  }).then(dependencies =>
    dependencies.filter(dependency => !dependency.isPolyfill())
  ).then(dependencies =>
    Promise.all(dependencies.map(dependency => dependency.getName()))
  );
}
function getReactNativeDependencyNames ( options ) { const blacklist = require ( 'react-native/packager/blacklist' ) ; const ReactPackager = require ( 'react-native/packager/react-packager' ) ; const rnEntryPoint = require . resolve ( 'react-native' ) ; return ReactPackager . getDependencies ( { blacklistRE : blacklist ( false /* don't blacklist any platform */ ) , projectRoots : options . projectRoots , assetRoots : options . assetRoots , transformModulePath : require . resolve ( 'react-native/packager/transformer' ) , } , { entryFile : rnEntryPoint , dev : true , platform : options . platform , } ) . then ( dependencies => dependencies . filter ( dependency => ! dependency . isPolyfill ( ) ) ) . then ( dependencies => Promise . all ( dependencies . map ( dependency => dependency . getName ( ) ) ) ) ; }
Extract all non-polyfill dependency names from the React Native packager.

@param  {Object}          options             Options
@param  {String}          options.projectRoot The project root path, where `node_modules/` is found
@param  {String}          options.platform    The platform for which to get dependencies
@return {Promise<Object>}                     Resolves with a webpack 'externals' configuration object
Extract all non - polyfill dependency names from the React Native packager .