const { getDefaultConfig } = require("expo/metro-config");
const path = require("path");

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

const config = getDefaultConfig(projectRoot);

// Watch the monorepo root so Metro sees all workspace packages
config.watchFolders = [monorepoRoot];

// Resolve modules from both the workspace and root node_modules
config.resolver.nodeModulesPaths = [
  path.resolve(projectRoot, "node_modules"),
  path.resolve(monorepoRoot, "node_modules"),
];

// Ensure symlinks are followed (npm workspaces use symlinks)
config.resolver.unstable_enableSymlinks = true;

module.exports = config;
