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:
@@ -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;
|
||||
Reference in New Issue
Block a user