From 23dd35d589323a9ad7c5887eaedcb8787c0c0ae0 Mon Sep 17 00:00:00 2001 From: andy <40680668+ajsmth@users.noreply.github.com> Date: Fri, 20 May 2022 11:15:26 -0700 Subject: [PATCH] [expotool] fix generate-bare-app metro config --- tools/src/commands/GenerateBareApp.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tools/src/commands/GenerateBareApp.ts b/tools/src/commands/GenerateBareApp.ts index a110c87e41df67..9707c7ffe685b0 100644 --- a/tools/src/commands/GenerateBareApp.ts +++ b/tools/src/commands/GenerateBareApp.ts @@ -38,7 +38,7 @@ export async function action( await symlinkPackages({ packagesToSymlink, projectDir }); await runExpoPrebuild({ projectDir }); await updateRNVersion({ projectDir, rnVersion }); - await createMetroConfig({ workspaceRoot: EXPO_DIR, projectRoot: projectDir }); + await createMetroConfig({ projectRoot: projectDir }); await createScripts({ projectDir }); // reestablish symlinks - some might be wiped out from prebuild @@ -235,10 +235,8 @@ async function runExpoPrebuild({ projectDir }: { projectDir: string }) { } async function createMetroConfig({ - workspaceRoot, projectRoot, }: { - workspaceRoot: string; projectRoot: string; }) { console.log('Adding metro.config.js for project'); @@ -249,13 +247,13 @@ const path = require('path'); const config = getDefaultConfig('${projectRoot}'); -// 1. Watch all files within the monorepo -config.watchFolders = ['${workspaceRoot}']; +// 1. Watch expo packages within the monorepo +config.watchFolders = ['${PACKAGES_DIR}']; // 2. Let Metro know where to resolve packages, and in what order config.resolver.nodeModulesPaths = [ path.resolve('${projectRoot}', 'node_modules'), - path.resolve('${workspaceRoot}', 'packages'), + path.resolve('${PACKAGES_DIR}'), ]; // Use Node-style module resolution instead of Haste everywhere