Skip to content

Commit cec7c51

Browse files
fix(sample): RN Sample doesn't show multiple promise packages warning (#3777)
1 parent 1e9298c commit cec7c51

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

samples/react-native/metro.config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,21 @@ const config = {
1919
`${parentDir}/node_modules`,
2020
],
2121
resolver: {
22+
resolveRequest: (context, moduleName, platform) => {
23+
if (moduleName.includes('promise/')) {
24+
return context.resolveRequest(
25+
{
26+
...context,
27+
// Ensures the promise module is resolved from the sample's node_modules.
28+
allowHaste: false,
29+
disableHierarchicalLookup: true,
30+
},
31+
moduleName,
32+
platform,
33+
);
34+
}
35+
return context.resolveRequest(context, moduleName, platform);
36+
},
2237
blacklistRE: blacklist([
2338
new RegExp(`${parentDir}/node_modules/react-native/.*`),
2439
new RegExp('.*\\android\\.*'), // Required for Windows in order to run the Sample.

0 commit comments

Comments
 (0)