Skip to content

Commit

Permalink
[expotool] fix generate-bare-app metro config
Browse files Browse the repository at this point in the history
  • Loading branch information
ajsmth committed May 20, 2022
1 parent f910c66 commit 23dd35d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions tools/src/commands/GenerateBareApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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');
Expand All @@ -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
Expand Down

0 comments on commit 23dd35d

Please sign in to comment.