-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathmetro.config.js
More file actions
38 lines (31 loc) · 1.24 KB
/
metro.config.js
File metadata and controls
38 lines (31 loc) · 1.24 KB
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
29
30
31
32
33
34
35
36
37
38
// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require('expo/metro-config');
const path = require('path');
// Find the workspace root, this can be replaced with `find-yarn-workspace-root`
const workspaceRoot = path.resolve(__dirname, '../..');
const projectRoot = __dirname;
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. Force react native entry point for web platform
config.resolver.resolveRequest = (context, moduleName, platform) => {
if (moduleName === '@walletconnect/ethereum-provider') {
const nativePath = path.resolve(
workspaceRoot,
'node_modules/@walletconnect/ethereum-provider/dist/index.native.js'
);
return {
type: 'sourceFile',
filePath: nativePath
};
}
return context.resolveRequest(context, moduleName, platform);
};
module.exports = config;