← back to Nineoh Guide

apps/mobile/metro.config.js

23 lines

// Metro config for the Expo app inside the nineoh-guide pnpm/Turborepo monorepo.
// Learn more: https://docs.expo.dev/guides/monorepos/
const { getDefaultConfig } = require("expo/metro-config");
const path = require("path");

const projectRoot = __dirname;
const monorepoRoot = path.resolve(projectRoot, "../..");

const config = getDefaultConfig(projectRoot);

// 1. Watch the whole monorepo so Metro can see packages/core (@nineoh/core),
//    which lives outside apps/mobile.
config.watchFolders = [monorepoRoot];

// 2. Resolve modules from the app first, then the hoisted monorepo root
//    (where node-linker=hoisted places transitive deps like @babel/runtime).
config.resolver.nodeModulesPaths = [
  path.resolve(projectRoot, "node_modules"),
  path.resolve(monorepoRoot, "node_modules"),
];

module.exports = config;