forked from rnmapbox/maps
-
Notifications
You must be signed in to change notification settings - Fork 1
/
metro.config.js
62 lines (57 loc) · 1.51 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const path = require('path');
const fs = require('fs');
const blacklist = require('metro-config/src/defaults/exclusionList');
const glob = require('glob-to-regexp');
const assetRegistryPath = fs
.realpathSync(require.resolve('react-native/Libraries/Image/AssetRegistry'))
.replace('.js', '');
const inlineRequireBlockList = new Proxy(
{},
{
has: (target, name) => {
if (
name.endsWith('.js') &&
name.includes('/react-navigation-stack/lib/module/vendor/views/')
) {
return true;
}
return false;
},
},
);
function getBlacklist() {
const nodeModuleDirs = [
glob(`${path.resolve(__dirname, '..')}/node_modules/*`),
glob(`${path.resolve(__dirname, '..')}/docs/*`),
glob(`${path.resolve(__dirname, '..')}/e2e/*`),
glob(
`${path.resolve(__dirname)}/node_modules/*/node_modules/lodash.isequal/*`,
),
glob(
`${path.resolve(
__dirname,
)}/node_modules/*/node_modules/hoist-non-react-statics/*`,
),
glob(
`${path.resolve(
__dirname,
)}/node_modules/react-native/node_modules/@babel/*`,
),
];
return blacklist(nodeModuleDirs);
}
module.exports = {
resolver: {
blacklistRE: getBlacklist(),
},
watchFolders: [path.resolve(__dirname, '..')],
transformer: {
assetRegistryPath: assetRegistryPath,
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: { blockList: inlineRequireBlockList },
},
}),
},
};