-
Notifications
You must be signed in to change notification settings - Fork 297
Expand file tree
/
Copy pathmetro.config.js
More file actions
42 lines (39 loc) · 1.51 KB
/
metro.config.js
File metadata and controls
42 lines (39 loc) · 1.51 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
39
40
41
42
const path = require('path');
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
// Path to the SDK package (symlinked via node_modules)
const sdkPath = path.resolve(__dirname, '../../../sdk/runanywhere-react-native');
const sdkPackagesPath = path.join(sdkPath, 'packages');
const sdkCorePath = path.join(sdkPackagesPath, 'core');
const sdkRagPath = path.join(sdkPackagesPath, 'rag');
const sdkLlamaPath = path.join(sdkPackagesPath, 'llamacpp');
const sdkOnnxPath = path.join(sdkPackagesPath, 'onnx');
/**
* Metro configuration
* https://reactnative.dev/docs/metro
*
* @type {import('metro-config').MetroConfig}
*/
const config = {
watchFolders: [sdkPackagesPath],
resolver: {
// Ensure Metro resolves SDK packages from the workspace (symlinks can be flaky)
extraNodeModules: {
'@runanywhere/core': sdkCorePath,
'@runanywhere/rag': sdkRagPath,
'@runanywhere/llamacpp': sdkLlamaPath,
'@runanywhere/onnx': sdkOnnxPath,
},
// Allow Metro to resolve modules from the SDK
nodeModulesPaths: [
path.resolve(__dirname, 'node_modules'),
path.resolve(sdkPath, 'node_modules'),
],
// Don't hoist packages from the SDK - ensure local node_modules takes precedence
disableHierarchicalLookup: false,
// Ensure symlinks are followed
unstable_enableSymlinks: true,
// Prefer .js/.json over .ts/.tsx for compiled packages
sourceExts: ['js', 'json', 'ts', 'tsx'],
},
};
module.exports = mergeConfig(getDefaultConfig(__dirname), config);