Refactor mobile to fix dependency resolution and add polyfills

Update Expo and React dependencies to compatible versions. Create a
custom Metro config to resolve module conflicts in the workspace and
map Jest modules to local node_modules.

Add a SharedArrayBuffer polyfill for older runtimes and introduce an
adapter for expo-notifications to abstract direct imports.
This commit is contained in:
2026-05-12 22:29:38 +02:00
parent 3c6df95a86
commit 316e5def72
13 changed files with 371 additions and 150 deletions
+27
View File
@@ -0,0 +1,27 @@
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { getDefaultConfig } from 'expo/metro-config.js';
const projectRoot = path.dirname(fileURLToPath(import.meta.url));
const workspaceRoot = path.resolve(projectRoot, '../..');
const config = getDefaultConfig(projectRoot);
config.resolver.disableHierarchicalLookup = true;
config.resolver.nodeModulesPaths = [
path.resolve(projectRoot, 'node_modules'),
path.resolve(workspaceRoot, 'node_modules'),
];
config.resolver.extraNodeModules = {
react: path.resolve(projectRoot, 'node_modules/react'),
'react-test-renderer': path.resolve(projectRoot, 'node_modules/react-test-renderer'),
'react-native-safe-area-context': path.resolve(projectRoot, 'node_modules/react-native-safe-area-context'),
'react-native-screens': path.resolve(projectRoot, 'node_modules/react-native-screens'),
'@react-native-async-storage/async-storage': path.resolve(
projectRoot,
'node_modules/@react-native-async-storage/async-storage',
),
'expo-application': path.resolve(projectRoot, 'node_modules/expo-notifications/node_modules/expo-application'),
};
export default config;