freshyo/apps/user-ui/metro.config.js
2026-09-17 23:13:32 +05:30

33 lines
1.2 KiB
JavaScript
Executable file

// 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'))}[/\\\\].*$`),
];
module.exports = config;