Repository navigation
Expand file tree
/
Copy pathmetro.config.js
More file actions
53 lines (45 loc) · 1.41 KB
/
Copy pathmetro.config.js
File metadata and controls
53 lines (45 loc) · 1.41 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
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
const path = require('path');
const rootPackageJson = require('../package.json');
const root = path.resolve(__dirname, '..');
const modules = Object.keys(rootPackageJson.peerDependencies ?? {});
const defaultConfig = getDefaultConfig(__dirname);
const rootNodeModules = path.resolve(root, 'node_modules');
/**
* Metro configuration
* https://facebook.github.io/metro/docs/configuration
*
* @type {import('metro-config').MetroConfig}
*/
const config = {
watchFolders: [root, rootNodeModules],
// Keep peer dependencies resolved from the hoisted workspace root.
resolver: {
sourceExts: [...new Set([...defaultConfig.resolver?.sourceExts, 'json'])],
nodeModulesPaths: [
...defaultConfig.resolver?.nodeModulesPaths,
rootNodeModules,
],
extraNodeModules: modules.reduce(
(acc, name) => {
acc[name] = path.join(rootNodeModules, name);
return acc;
},
{
...defaultConfig.resolver?.extraNodeModules,
'@mj-studio/react-native-naver-map': path.resolve(root),
}
),
},
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: true,
},
}),
},
};
const merged = mergeConfig(defaultConfig, config);
// console.log(JSON.stringify(merged, null, 2))
module.exports = merged;