forked from rnmapbox/maps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmetro.config.js
64 lines (58 loc) · 1.69 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
63
64
/**
* Metro configuration for React Native
* https://github.com/facebook/react-native
*
* @format
*/
const path = require('path');
/*
See
https://medium.com/@dushyant_db/how-to-import-files-from-outside-of-root-directory-with-react-native-metro-bundler-18207a348427
*/
// exclusionList is a function that takes an array of regexes and combines
// them with the default exclusions to return a single regex.
const exclusionList = require('metro-config/src/defaults/exclusionList');
const glob = require('glob-to-regexp');
const extraNodeModules = {
'@react-native-mapbox-gl/maps': path.resolve(__dirname + '/../maps'),
};
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/fbjs/*`),
glob(
`${path.resolve(
__dirname,
)}/node_modules/*/node_modules/hoist-non-react-statics/*`,
),
glob(
`${path.resolve(
__dirname,
)}/node_modules/react-native/node_modules/@babel/*`,
),
];
return exclusionList(nodeModuleDirs);
}
module.exports = {
resolver: {
blacklistRE: getBlacklist(),
extraNodeModules: new Proxy(extraNodeModules, {
get: (target, name) => {
return name in target
? target[name]
: path.join(process.cwd(), `node_modules/${name}`);
},
}),
},
watchFolders: [path.resolve(__dirname, '..')],
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: true,
},
}),
},
};