|
1 | 1 | // -i- Copied from https://docs.expo.dev/guides/monorepos/#modify-the-metro-config
|
2 |
| -const { getDefaultConfig } = require('expo/metro-config'); |
3 |
| -const path = require('path'); |
| 2 | +const { getDefaultConfig } = require('expo/metro-config') |
| 3 | +const path = require('path') |
4 | 4 |
|
5 | 5 | // Find the project and workspace directories
|
6 |
| -const projectRoot = __dirname; |
7 |
| - |
8 |
| -// This can be replaced with `find-yarn-workspace-root` |
9 |
| -const workspaceRoot = path.resolve(projectRoot, '../..'); |
10 |
| -const config = getDefaultConfig(projectRoot); |
| 6 | +const projectRoot = __dirname |
| 7 | +const workspaceRoot = path.resolve(projectRoot, '../..') |
| 8 | +const config = getDefaultConfig(projectRoot) |
11 | 9 |
|
12 | 10 | // 1. Watch all files within the monorepo
|
13 |
| -config.watchFolders = [workspaceRoot]; |
| 11 | +config.watchFolders = [workspaceRoot] |
14 | 12 |
|
15 | 13 | // 2. Let Metro know where to resolve packages and in what order
|
16 | 14 | config.resolver.nodeModulesPaths = [
|
17 | 15 | path.resolve(projectRoot, 'node_modules'),
|
18 | 16 | path.resolve(workspaceRoot, 'node_modules'),
|
19 |
| -]; |
| 17 | +] |
20 | 18 |
|
21 | 19 | // 3. Force Metro to resolve (sub)dependencies only from the `nodeModulesPaths`
|
22 |
| -// config.resolver.disableHierarchicalLookup = true; |
| 20 | +// config.resolver.disableHierarchicalLookup = true |
23 | 21 |
|
24 | 22 | // Export the modified config
|
25 |
| -module.exports = config; |
| 23 | +module.exports = config |
0 commit comments