Skip to content

Instantly share code, notes, and snippets.

@slvssb
Created January 13, 2024 10:56
Show Gist options
  • Save slvssb/309fd7b69a5a3fec37226ec6a24743f8 to your computer and use it in GitHub Desktop.
Save slvssb/309fd7b69a5a3fec37226ec6a24743f8 to your computer and use it in GitHub Desktop.
const { getDefaultConfig } = require("expo/metro-config")
const path = require("path")
// Find the project and workspace directories
const projectRoot = __dirname
// This can be replaced with `find-yarn-workspace-root`
const workspaceRoot = path.resolve(projectRoot, "../..")
const config = getDefaultConfig(projectRoot)
// 1. Watch all files within the monorepo
config.watchFolders = [workspaceRoot]
// 2. Let Metro know where to resolve packages and in what order
config.resolver.nodeModulesPaths = [
path.resolve(projectRoot, "node_modules"),
path.resolve(workspaceRoot, "node_modules"),
]
// 3. Force Metro to resolve (sub)dependencies only from the `nodeModulesPaths`
config.resolver.disableHierarchicalLookup = true
// 4. See issue https://github.com/honojs/hono/issues/1773
config.resolver.unstable_enableSymlinks = true
config.resolver.unstable_enablePackageExports = true
module.exports = config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment