Skip to content

Instantly share code, notes, and snippets.

@ydrea
Created September 8, 2025 10:16
Show Gist options
  • Save ydrea/9ffef13a7fb155e7ef5f97ca006b6251 to your computer and use it in GitHub Desktop.
Save ydrea/9ffef13a7fb155e7ef5f97ca006b6251 to your computer and use it in GitHub Desktop.
const { getDefaultConfig } = require('expo/metro-config');
/** @type {import('expo/metro-config').MetroConfig} */
const config = getDefaultConfig(__dirname);
// Keep your custom source extension if needed
if (config.resolver.sourceExts && !config.resolver.sourceExts.includes('sql')) {
config.resolver.sourceExts.push('sql');
}
// Add alias for react-native-maps to web implementation
const ALIASES = {
'react-native-maps': '@teovilla/react-native-web-maps',
};
config.resolver.resolveRequest = (context, moduleName, platform) => {
if (platform === 'web') {
// Use the alias only for web
return context.resolveRequest(context, ALIASES[moduleName] ?? moduleName, platform);
}
// Default resolver for other platforms
return context.resolveRequest(context, moduleName, platform);
};
module.exports = config;
// web
// metro.config.js
const { getDefaultConfig } = require('expo/metro-config');
/** @type {import('expo/metro-config').MetroConfig} */
const config = getDefaultConfig(__dirname);
// Keep your custom source extension if needed
if (config.resolver.sourceExts && !config.resolver.sourceExts.includes('sql')) {
config.resolver.sourceExts.push('sql');
}
// Add alias for react-native-maps to web implementation
const ALIASES = {
'react-native-maps': '@teovilla/react-native-web-maps',
};
config.resolver.resolveRequest = (context, moduleName, platform) => {
if (platform === 'web') {
// Use the alias only for web
return context.resolveRequest(context, ALIASES[moduleName] ?? moduleName, platform);
}
// Default resolver for other platforms
return context.resolveRequest(context, moduleName, platform);
};
module.exports = config;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment