-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmetro.config.js
57 lines (50 loc) · 1.58 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
const path = require('path');
const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
const escape = require('escape-string-regexp');
const exclusionList = require('metro-config/src/defaults/exclusionList');
const pkg = require('./package.json');
const root = path.resolve(__dirname);
const sample = path.resolve(root, 'sample');
const modules = Object.keys({...pkg.peerDependencies});
/**
* Metro configuration
* https://reactnative.dev/docs/metro
*
* @type {import('metro-config').MetroConfig}
*/
const config = mergeConfig(getDefaultConfig(__dirname), {
projectRoot: sample,
watchFolders: [root],
// We need to make sure that only one version is loaded for peerDependencies
// So we block them at the root, and alias them to the versions in example's node_modules
resolver: {
blacklistRE: exclusionList(
modules.map(
m => new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`),
),
),
extraNodeModules: {
react: path.resolve(sample, 'node_modules', 'react'),
'react-native': path.resolve(sample, 'node_modules', 'react-native'),
'react-native-gesture-handler': path.resolve(
root,
'node_modules',
'react-native-gesture-handler',
),
'@shopify/checkout-sheet-kit': path.resolve(
root,
'modules',
'@shopify/checkout-sheet-kit',
),
},
},
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: true,
},
}),
},
});
module.exports = config;