Skip to content

Commit

Permalink
metro config "polyfill"
Browse files Browse the repository at this point in the history
  • Loading branch information
haileyok committed Apr 9, 2024
1 parent db750e3 commit e165d49
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e165d49

Please sign in to comment.