// Learn more on how to setup config for the app: https://docs.expo.dev/guides/config-plugins/#metro-config const { getDefaultConfig } = require('expo/metro-config'); const path = require('path'); const config = getDefaultConfig(__dirname); // Add the packages directory to watch folders config.watchFolders = [ ...config.watchFolders || [], path.resolve(__dirname, '../../packages/shared'), ]; // Configure module resolution for @packages/* config.resolver.extraNodeModules = { ...config.resolver.extraNodeModules, '@packages/shared': path.resolve(__dirname, '../../packages/shared'), 'global-shared': path.resolve(__dirname, '../../packages/shared'), }; // Never bundle the test folder. It is tooled by Jest (see tests/jest.config.js) // and excluded from EAS uploads (.easignore); blocking it here makes an // accidental production import fail loudly instead of silently shipping. const escapeForRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); config.resolver.blockList = [ ...(config.resolver.blockList ? [].concat(config.resolver.blockList) : []), new RegExp(`^${escapeForRegExp(path.resolve(__dirname, 'tests'))}[/\\\\].*$`), ]; // expo-router's public entry requires `withLayoutContext` -> NativeTabTrigger // -> optional-libraries/expo-symbols, which does `require('expo-symbols')` at // module scope. That drags @expo-google-fonts/material-symbols (976 KB) into // every bundle for a native-tabs feature this app never uses. Nothing imports // expo-symbols directly, so resolve it to an empty module. const upstreamResolveRequest = config.resolver.resolveRequest; config.resolver.resolveRequest = (context, moduleName, platform) => { if (moduleName === 'expo-symbols') { return { type: 'empty' }; } return upstreamResolveRequest ? upstreamResolveRequest(context, moduleName, platform) : context.resolveRequest(context, moduleName, platform); }; module.exports = config;