Skip to content

fix: configure Metro for monorepo local development in expo-example#387

Merged
Rosie-Kennelly-1 merged 3 commits intomainfrom
rosie/expo-example-metro-monorepo-config
Mar 10, 2026
Merged

fix: configure Metro for monorepo local development in expo-example#387
Rosie-Kennelly-1 merged 3 commits intomainfrom
rosie/expo-example-metro-monorepo-config

Conversation

@Rosie-Kennelly-1
Copy link
Contributor

@Rosie-Kennelly-1 Rosie-Kennelly-1 commented Mar 9, 2026

Why?

Running the expo-example locally for development currently fails with a cascade of Metro errors — unresolved modules, duplicate React Native copies, and SyntaxErrors from stale dependencies in the library root's node_modules. This makes it tedious to set up and test changes to the library.

How?

Adds the standard monorepo Metro configuration (watchFolders, nodeModulesPaths, blockList) so Metro can resolve the symlinked @intercom/intercom-react-native package while keeping dependency resolution scoped to the example's own node_modules.

  1. watchFolders = [libraryRoot] — tells Metro "the library source lives two directories up, watch it for changes." Without this, Metro can't find @intercom/intercom-react-native at all → "Unable to resolve module" error.

  2. nodeModulesPaths = [path.resolve(__dirname, 'node_modules')] — tells Metro "resolve all dependencies from the example's node_modules only." Without this, Metro also picks up node_modules from the library root, which has a different (older) version of react-native → duplicate React Native copies and SyntaxError on VirtualView.js.

  3. blockList = [...] — explicitly blocks the library root's node_modules from Metro's module resolution. Belt-and-suspenders with IOS SDK Bridge #2 to prevent any transitive resolution from leaking through.

Generated with Claude Code

Without watchFolders, nodeModulesPaths, and blockList, Metro cannot
resolve the symlinked @intercom/intercom-react-native package when
developing locally from examples/expo-example. This caused a cascade
of errors: unresolved modules, duplicate React Native copies, and
SyntaxError from stale dependencies in the library root's node_modules.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Rosie-Kennelly-1 Rosie-Kennelly-1 enabled auto-merge (squash) March 10, 2026 11:02
@Rosie-Kennelly-1 Rosie-Kennelly-1 merged commit 187961a into main Mar 10, 2026
6 of 8 checks passed
@Rosie-Kennelly-1 Rosie-Kennelly-1 deleted the rosie/expo-example-metro-monorepo-config branch March 10, 2026 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants