From e165d496c9a85efdcf0c74bc333ee6cdcbf7f043 Mon Sep 17 00:00:00 2001 From: Hailey Date: Tue, 9 Apr 2024 10:38:40 -0700 Subject: [PATCH] metro config "polyfill" --- metro.config.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/metro.config.js b/metro.config.js index a49d95f9aa..c3cd6e9649 100644 --- a/metro.config.js +++ b/metro.config.js @@ -6,6 +6,17 @@ cfg.resolver.sourceExts = process.env.RN_SRC_EXT ? process.env.RN_SRC_EXT.split(',').concat(cfg.resolver.sourceExts) : cfg.resolver.sourceExts +cfg.resolver.resolveRequest = (context, moduleName, platform) => { + if (moduleName === 'crypto' && platform !== 'web') { + return context.resolveRequest( + context, + 'react-native-quick-crypto', + platform, + ) + } + return context.resolveRequest(context, moduleName, platform) +} + cfg.transformer.getTransformOptions = async () => ({ transform: { experimentalImportSupport: true,