fix: configure metro and App entry for Expo Go dev server

- Updated App.tsx to use proper Stack navigation
- Created ESM-compatible metro.config.js
- Fixed module resolution for monorepo structure
- Dev server now starts successfully

Ready to test on physical devices via Expo Go app
This commit is contained in:
bananabas 2026-03-28 07:40:29 +00:00
parent d6e9cde6db
commit f69fb1e5cf
2 changed files with 53 additions and 5 deletions

View file

@ -1,7 +1,33 @@
import { ExpoRoot } from 'expo-router';
import { useFonts } from 'expo-font';
import { SplashScreen, Stack } from 'expo-router';
import { useEffect } from 'react';
export const unstable_settings = {
initialRouteName: '(app)',
};
export {
// Catch any errors thrown by the Layout component.
ErrorBoundary,
} from 'expo-router';
export default ExpoRoot;
// Prevent the splash screen from auto-hiding before asset loading is complete.
SplashScreen.preventAutoHideAsync();
export default function RootLayout() {
const [fontsLoaded, fontError] = useFonts({});
useEffect(() => {
if (fontsLoaded || fontError) {
SplashScreen.hideAsync();
}
}, [fontsLoaded, fontError]);
if (!fontsLoaded && !fontError) {
return null;
}
return (
<Stack
screenOptions={{
headerShown: false,
}}
/>
);
}

View file

@ -0,0 +1,22 @@
import { getDefaultConfig } from 'expo/metro-config.js';
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const projectRoot = __dirname;
const monorepoRoot = path.resolve(projectRoot, '../..');
const config = getDefaultConfig(projectRoot);
// Extend the resolver to handle monorepo
config.resolver.sourceExts = ['ts', 'tsx', 'js', 'jsx', 'json', 'mjs'];
config.resolver.extraNodeModules = {
'@shop/types': path.resolve(monorepoRoot, 'packages/types'),
};
// Ensure app root is correct
config.projectRoot = projectRoot;
export default config;