Skip to content

Commit 8b2cb4a

Browse files
committed
now opening on ios
1 parent 9884931 commit 8b2cb4a

File tree

2 files changed

+28
-9
lines changed

2 files changed

+28
-9
lines changed
Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,35 @@
1-
const path = require('path');
1+
const path = require('node:path');
2+
const fs = require('node:fs');
23
const { getDefaultConfig } = require('@expo/metro-config');
3-
const { withMetroConfig } = require('react-native-monorepo-config');
4+
const { makeMetroConfig } = require('@rnx-kit/metro-config');
45

5-
const root = path.resolve(__dirname, '..');
6+
const exampleWorkspace = path.resolve(__dirname, '.');
7+
const nativescriptJsi = path.resolve(__dirname, '..');
8+
const monorepoRoot = path.resolve(__dirname, '../../..');
9+
10+
const allNodeModules = [
11+
path.resolve(exampleWorkspace, 'node_modules'),
12+
path.resolve(nativescriptJsi, 'node_modules'),
13+
path.resolve(monorepoRoot, 'node_modules'),
14+
];
615

716
/**
817
* Metro configuration
918
* https://facebook.github.io/metro/docs/configuration
1019
*
1120
* @type {import('metro-config').MetroConfig}
1221
*/
13-
const config = withMetroConfig(getDefaultConfig(__dirname), {
14-
root,
15-
dirname: __dirname,
16-
});
22+
const config = makeMetroConfig(getDefaultConfig(__dirname));
23+
24+
config.resolver.nodeModulesPaths = allNodeModules;
25+
config.resolver.extraNodeModules = {
26+
'nativescript-jsi': nativescriptJsi,
27+
};
28+
29+
config.watchFolders = [
30+
...allNodeModules.filter((filePath) => fs.existsSync(filePath)),
31+
nativescriptJsi,
32+
];
33+
console.log(config.watchFolders);
1734

1835
module.exports = config;

packages/jsi/example/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
"private": true,
1717
"devDependencies": {
1818
"@expo/metro-config": "54.0.14",
19+
"@react-native/metro-config": "^0.84.0",
20+
"@rnx-kit/metro-config": "^2.2.4",
21+
"babel-preset-expo": "^54.0.10",
1922
"expo-dev-client": "~6.0.20",
20-
"react-native-builder-bob": "^0.40.18",
21-
"react-native-monorepo-config": "^0.3.3"
23+
"react-native-builder-bob": "^0.40.18"
2224
}
2325
}

0 commit comments

Comments
 (0)