-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmetro.config.js
More file actions
56 lines (46 loc) · 1.56 KB
/
metro.config.js
File metadata and controls
56 lines (46 loc) · 1.56 KB
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
// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require("expo/metro-config");
const path = require("path");
const config = getDefaultConfig(__dirname);
// Modify the resolver to include the path to your library
config.resolver.extraNodeModules = new Proxy(
{},
{
get: (target, name) => {
// Redirects dependencies by name
if (name === "@codeherence/react-native-graph") {
return path.join(__dirname, "..", "src");
}
return path.join(process.cwd(), "node_modules", name);
},
}
);
// npm v7+ will install ../node_modules/react-native because of peerDependencies.
// To prevent the incompatible react-native bewtween ./node_modules/react-native and ../node_modules/react-native,
// excludes the one from the parent folder when bundling.
const IGNORED_LIBS = [
"react",
"react-dom",
"react-native",
"@shopify/react-native-skia",
"react-native-reanimated",
"react-native-gesture-handler",
];
config.resolver.blockList = [
...Array.from(config.resolver.blockList ?? []),
...IGNORED_LIBS.map((lib) => new RegExp(path.resolve("..", "node_modules", lib))),
];
config.resolver.nodeModulesPaths = [
path.resolve(__dirname, "node_modules"),
path.resolve(__dirname, "../node_modules"),
];
config.resolver.assetExts.push("mjs");
config.resolver.assetExts.push("cjs");
config.watchFolders = [path.resolve(__dirname, "..")];
config.transformer.getTransformOptions = async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: true,
},
});
module.exports = config;