Files
minibits_wallet/metro.config.js
T
2026-01-10 00:39:30 +01:00

54 lines
1.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
const { withSentryConfig } = require("@sentry/react-native/metro");
/**
* Metro configuration
* https://reactnative.dev/docs/metro
*
* @type {import('@react-native/metro-config').MetroConfig}
*/
const config = {
resolver: {
// Ensure Metro can resolve .cjs files (CommonJS modules)
sourceExts: ['jsx', 'js', 'ts', 'tsx', 'json', 'cjs'],
// Workaround for Unicode character issues in @noble/curves
// Files with Greek letters (β, α) cause "Property β does not exist" errors in Hermes
/*resolveRequest: (context, moduleName, platform) => {
// Force cashu-ts to use pre-built CJS bundle
if (moduleName === '@cashu/cashu-ts') {
return {
filePath: context.resolveRequest(context, '@cashu/cashu-ts/lib/cashu-ts.cjs', platform).filePath,
type: 'sourceFile',
};
}
// Block problematic @noble/curves files that contain Unicode characters
// Allow only essential modules needed for secp256k1
if (moduleName.startsWith('@noble/curves/')) {
const allowed = [
'secp256k1',
'abstract/modular',
'abstract/weierstrass',
'_shortw_utils',
'utils'
];
const isAllowed = allowed.some(path => moduleName.includes(path));
if (!isAllowed) {
// Return empty stub for blocked imports (contains Unicode chars incompatible with Hermes)
const stubPath = require('path').resolve(__dirname, 'node_modules/.metro-stub.js');
return {
filePath: stubPath,
type: 'sourceFile',
};
}
}
// Default resolution
return context.resolveRequest(context, moduleName, platform);
},*/
},
};
module.exports = withSentryConfig(mergeConfig(getDefaultConfig(__dirname), config));