-
Notifications
You must be signed in to change notification settings - Fork 107
/
metro.config.js
37 lines (34 loc) · 1.3 KB
/
metro.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
const path = require("path");
const metroResolver = require("metro-resolver");
const exclusionList = require('metro-config/src/defaults/exclusionList');
// exclusionList is a function that takes an array of regexes and combines
// them with the default exclusions to return a single regex.
/**
* Metro configuration
* https://reactnative.dev/docs/metro
*
* @type {import('metro-config').MetroConfig}
*/
const config = {
resolver: {
blacklistRE: exclusionList([
/node_modules\/hermes-parser\/.*/,
/node_modules\/metro-hermes-compiler\/.*/,
]),
resolveRequest: (context, realModuleName, platform, moduleName) => {
if (['hermes-parser', 'metro-hermes-compiler'].includes(moduleName || realModuleName)) {
return {
filePath: path.resolve(__dirname + "/js/dummy.js"),
type: "sourceFile"
};
}
return metroResolver.resolve(
{ ...context, resolveRequest: undefined },
moduleName || realModuleName,
platform
);
}
}
};
module.exports = mergeConfig(getDefaultConfig(__dirname), config);