Skip to content

Commit

Permalink
fix(sample): RN Sample doesn't show multiple promise packages warning (
Browse files Browse the repository at this point in the history
  • Loading branch information
krystofwoldrich committed Apr 29, 2024
1 parent 1e9298c commit cec7c51
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions samples/react-native/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@ const config = {
`${parentDir}/node_modules`,
],
resolver: {
resolveRequest: (context, moduleName, platform) => {
if (moduleName.includes('promise/')) {
return context.resolveRequest(
{
...context,
// Ensures the promise module is resolved from the sample's node_modules.
allowHaste: false,
disableHierarchicalLookup: true,
},
moduleName,
platform,
);
}
return context.resolveRequest(context, moduleName, platform);
},
blacklistRE: blacklist([
new RegExp(`${parentDir}/node_modules/react-native/.*`),
new RegExp('.*\\android\\.*'), // Required for Windows in order to run the Sample.
Expand Down

0 comments on commit cec7c51

Please sign in to comment.