// Metro config for an Expo app inside an npm-workspaces monorepo.
// Lets Metro resolve and watch the sibling `parksmarter-client` package.
const { getDefaultConfig } = require('expo/metro-config');
const path = require('path');

const projectRoot = __dirname;
const workspaceRoot = path.resolve(projectRoot, '..');

const config = getDefaultConfig(projectRoot);

// Watch the whole monorepo so edits to parksmarter-client hot-reload.
config.watchFolders = [workspaceRoot];

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

module.exports = config;
