|
1 | | -// Learn more https://docs.expo.io/guides/customizing-metro |
2 | | -const { getDefaultConfig } = require('expo/metro-config'); |
| 1 | +const path = require('path'); |
| 2 | +const exclusionList = require('metro-config/src/defaults/exclusionList'); |
| 3 | +const { getDefaultConfig } = require('@expo/metro-config'); |
3 | 4 |
|
4 | | -/** @type {import('expo/metro-config').MetroConfig} */ |
5 | | -const config = getDefaultConfig(__dirname); |
| 5 | +const projectRoot = __dirname; |
| 6 | +const workspaceRoot = path.resolve(projectRoot, '..'); |
6 | 7 |
|
7 | | -const packagePath = "../"; |
| 8 | +const config = getDefaultConfig(projectRoot); |
8 | 9 |
|
9 | | -config.resolver.nodeModulesPaths.push(packagePath); |
| 10 | +config.watchFolders = [workspaceRoot]; |
10 | 11 |
|
11 | | -config.watchFolders.push(packagePath); |
| 12 | +config.resolver.nodeModulesPaths = [ |
| 13 | + path.resolve(projectRoot, 'node_modules'), |
| 14 | + path.resolve(workspaceRoot, 'node_modules'), |
| 15 | +]; |
| 16 | + |
| 17 | +config.resolver.extraNodeModules = { |
| 18 | + 'cloudinary-react-native': path.resolve(workspaceRoot), |
| 19 | +}; |
| 20 | + |
| 21 | +// 🚫 Exclude nested react-native versions |
| 22 | +config.resolver.blockList = exclusionList([ |
| 23 | + new RegExp(`${workspaceRoot}/node_modules/react-native/.*`), |
| 24 | +]); |
12 | 25 |
|
13 | 26 | module.exports = config; |
0 commit comments