-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathmetro.config.js
More file actions
80 lines (66 loc) · 2.74 KB
/
metro.config.js
File metadata and controls
80 lines (66 loc) · 2.74 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/* eslint-env node */
const _ = require('lodash');
const path = require('path');
const { getSentryExpoConfig } = require('@sentry/react-native/metro');
//const { getDefaultConfig } = require('expo/metro-config');
//const path = require('path');
const { withNativeWind } = require('nativewind/metro');
const config = getSentryExpoConfig(__dirname, {
isCSSEnabled: true,
});
// 1. Watch all files within the monorepo
// 2. Let Metro know where to resolve packages and in what order
//config.resolver.nodeModulesPaths = [path.resolve(__dirname, 'node_modules')];
// Configure path aliases
//config.resolver.extraNodeModules = {
// '@': path.resolve(__dirname, 'src'),
// '@env': path.resolve(__dirname, 'src/lib/env.js'),
// '@assets': path.resolve(__dirname, 'assets'),
//};
// Add platform-specific resolutions for web and desktop platforms
// Desktop platforms (macOS/Windows) use web implementations where appropriate
const desktopPlatforms = ['macos', 'windows'];
config.resolver.resolveRequest = (context, moduleName, platform) => {
// Check if this is a web-like platform (web, macos, or windows)
const isWebLikePlatform = platform === 'web' || desktopPlatforms.includes(platform);
if (isWebLikePlatform) {
// LiveKit WebRTC mocks - not needed on web/desktop (uses web WebRTC)
if (moduleName === '@livekit/react-native-webrtc' || moduleName === '@livekit/react-native') {
return {
type: 'empty',
};
}
// MMKV storage mock for web/desktop
if (moduleName === 'react-native-mmkv') {
return {
type: 'sourceFile',
filePath: path.resolve(__dirname, '__mocks__/react-native-mmkv.ts'),
};
}
// expo-keep-awake mock for web/desktop
if (moduleName === 'expo-keep-awake') {
return {
type: 'sourceFile',
filePath: path.resolve(__dirname, '__mocks__/expo-keep-awake.ts'),
};
}
// Notifee - iOS/Android only, mock for web/desktop
if (moduleName === '@notifee/react-native') {
return {
type: 'sourceFile',
filePath: path.resolve(__dirname, '__mocks__/runtime/@notifee/react-native.ts'),
};
}
// CallKeep - iOS only, mock for web/desktop
if (moduleName === 'react-native-callkeep') {
return {
type: 'sourceFile',
filePath: path.resolve(__dirname, '__mocks__/runtime/react-native-callkeep.ts'),
};
}
}
// Ensure you call the default resolver for all other modules
return context.resolveRequest(context, moduleName, platform);
};
config.resolver.unstable_conditionNames = _.uniq(config.resolver.unstable_conditionNames.concat('browser', 'require', 'react-native')); // <-- and here we can override what we want
module.exports = withNativeWind(config, { input: './global.css', inlineRem: 16 });