forked from audrius-savickas/rnw-community
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmetro.config.js
28 lines (23 loc) · 1.11 KB
/
metro.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/**
* Metro configuration
* https://facebook.github.io/metro/docs/configuration
*
* @type {import('metro-config').MetroConfig}
*
* TODO: This is a temporary workaround as this config should be inside the react-native-payments-example package
* This solution is from here: https://docs.expo.dev/guides/monorepos/
*/
const path = require('path');
const { getDefaultConfig } = require('@react-native/metro-config');
// Find the project and workspace directories
const projectRoot = path.resolve('./packages/react-native-payments-example');
// 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;
module.exports = config;