How to use the metro-config.mergeConfig function in metro-config

To help you get started, we’ve selected a few metro-config examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Carimus / metro-symlinked-deps / index.js View on Github external
function mergeConfig(...args) {
    const mergedConfig = metroMergeConfig(...args);

    // We need to remove the invalid `symbolicator` config key if it's present and empty.
    if (
        mergedConfig.symbolicator &&
        Object.values(mergedConfig.symbolicator).length === 0
    ) {
        delete mergedConfig.symbolicator;
    }

    return mergedConfig;
}
github godaddy / ekke / api / metro / configure.js View on Github external
// - And point to the correct AssetRegistry, also hidden in the React-Native
  //   module.
  //
  // The `providesModuleNodeModules` and `hasteImplModulePath` are currently
  // not needed to correctly configure metro for Ekke as we're replacing
  // `react-native` with  polyfill, but if we for some reason turn this off,
  // we don't want to research the undocumented codebase of Metro, cli, and
  // React-Native again to figure out how to correctly resolve and bundle
  // React-Native.
  //
  custom.resolver.providesModuleNodeModules = ['react-native'];
  custom.resolver.hasteImplModulePath = path.join(reactNativePath, 'jest/hasteImpl');
  custom.resolver.resolverMainFields = ['react-native', 'browser', 'main'];
  custom.transformer.assetRegistryPath = path.join(reactNativePath, 'Libraries/Image/AssetRegistry');

  const merged = mergeConfig(config, custom);
  debug('metro config', merged);

  return merged;
}
github timfpark / react-native-location / tests / integration / metro.config.js View on Github external
{},
      {
        get: (target, name) => {
          if (name === "react-native-location") {
            return join(__dirname, `../../src`);
          }
          return join(__dirname, `node_modules/${name}`);
        }
      }
    ),
    platforms: ["android", "ios"]
  },
  watchFolders: [resolve(__dirname, "../../src")]
};

module.exports = mergeConfig(DEFAULT, config);
github facebook / metro / packages / metro / src / index.js View on Github external
async function getConfig(config: InputConfigT): Promise {
  const defaultConfig = await getDefaultConfig(config.projectRoot);
  return mergeConfig(defaultConfig, config);
}