Created
September 2, 2025 01:22
-
-
Save billsbooth/8e4cea549714b99fe1e8c36089824046 to your computer and use it in GitHub Desktop.
OX Metro
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { getSentryExpoConfig } = require('@sentry/react-native/metro'); | |
const exclusionList = require('metro-config/src/defaults/exclusionList'); | |
// const path = require('path'); | |
// const fs = require('fs'); | |
/** | |
* Metro configuration | |
* https://metrobundler.dev/docs/configuration | |
* | |
* @type {import('metro-config').MetroConfig} | |
*/ | |
const config = getSentryExpoConfig(__dirname); | |
// FIXES https://github.com/expo/expo/discussions/36551. | |
config.resolver.unstable_enablePackageExports = false; | |
const { transformer, resolver } = config; | |
const modulesToEnableExports = [ | |
'@privy-io/expo', | |
'@privy-io/expo/passkey', | |
'ox', | |
]; | |
const resolveRequestWithPackageExports = (context, moduleName, platform) => { | |
// Enable package exports selectively for specific modules. | |
if (modulesToEnableExports.includes(moduleName)) { | |
const ctx = { | |
...context, | |
unstable_enablePackageExports: true, | |
}; | |
return ctx.resolveRequest(ctx, moduleName, platform); | |
} | |
// No custom fallback | |
return context.resolveRequest(context, moduleName, platform); | |
}; | |
config.resolver.resolveRequest = resolveRequestWithPackageExports; | |
config.transformer = { | |
...transformer, | |
babelTransformerPath: require.resolve('react-native-svg-transformer/expo'), | |
}; | |
config.resolver = { | |
...resolver, | |
assetExts: resolver.assetExts.filter((ext) => ext !== 'svg'), | |
sourceExts: [...resolver.sourceExts, 'svg'], | |
// The Scripts folder has localization automation that we shouldn't ship with the app. | |
blacklistRE: exclusionList([/scripts\/.*/]), | |
}; | |
// No additional custom resolver overrides | |
module.exports = config; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment