Skip to content

Commit 187961a

Browse files
fix: configure Metro for monorepo local development in expo-example (#387)
* fix: configure Metro for monorepo local development in expo-example 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> * style: fix Prettier formatting in metro config Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a9de7b9 commit 187961a

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1+
const path = require('path');
12
const { getDefaultConfig } = require('expo/metro-config');
23
const { withNativeWind } = require('nativewind/metro');
34

5+
const libraryRoot = path.resolve(__dirname, '..', '..');
6+
47
const config = getDefaultConfig(__dirname);
58
config.resolver.unstable_enableSymlinks = true;
9+
config.watchFolders = [libraryRoot];
10+
config.resolver.nodeModulesPaths = [path.resolve(__dirname, 'node_modules')];
11+
config.resolver.blockList = [
12+
new RegExp(path.resolve(libraryRoot, 'node_modules') + '/.*'),
13+
];
614

715
module.exports = withNativeWind(config, { input: './global.css' });

0 commit comments

Comments
 (0)