1import { loadMetroConfigAsync } from '../../start/server/metro/instantiateMetro'; 2import { importCliBuildBundleWithConfigFromProject } from '../../start/server/metro/resolveFromProject'; 3import { Options } from './resolveOptions'; 4 5export async function exportEmbedAsync(projectRoot: string, options: Options) { 6 const { config } = await loadMetroConfigAsync(projectRoot, { 7 maxWorkers: options.maxWorkers, 8 resetCache: options.resetCache, 9 config: options.config, 10 }); 11 12 const buildBundleWithConfig = importCliBuildBundleWithConfigFromProject(projectRoot); 13 14 // Import the internal `buildBundleWithConfig()` function from `react-native` for the purpose 15 // of exporting with `@expo/metro-config` and other defaults like a resolved project entry. 16 await buildBundleWithConfig( 17 options, 18 // @ts-expect-error: MetroConfig type mismatch. 19 config 20 ); 21} 22