metro.config.js 813 B

12345678910111213141516171819202122
  1. // Learn more https://docs.expo.dev/guides/monorepos
  2. const { getDefaultConfig } = require('expo/metro-config')
  3. const path = require('node:path')
  4. // Find the project and workspace directories
  5. const projectRoot = __dirname
  6. // This can be replaced with `find-yarn-workspace-root`
  7. const workspaceRoot = path.resolve(projectRoot, '../../')
  8. const config = getDefaultConfig(projectRoot)
  9. // 1. Watch all files within the monorepo
  10. config.watchFolders = [workspaceRoot]
  11. // 2. Let Metro know where to resolve packages and in what order
  12. config.resolver.nodeModulesPaths = [
  13. path.resolve(projectRoot, 'node_modules'),
  14. path.resolve(workspaceRoot, 'node_modules'),
  15. ]
  16. // 3. Force Metro to resolve (sub)dependencies only from the `nodeModulesPaths`
  17. config.resolver.disableHierarchicalLookup = true
  18. module.exports = config