Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
}
// - 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;
}
{},
{
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);
async function getConfig(config: InputConfigT): Promise {
const defaultConfig = await getDefaultConfig(config.projectRoot);
return mergeConfig(defaultConfig, config);
}