-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmetro.config.js
More file actions
44 lines (39 loc) · 1.36 KB
/
Copy pathmetro.config.js
File metadata and controls
44 lines (39 loc) · 1.36 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
const path = require('path');
const { getDefaultConfig } = require('@react-native/metro-config');
const { withMetroConfig } = require('react-native-monorepo-config');
const root = path.resolve(__dirname, '../..');
const packageName = require('../../package.json').name;
const rnwPath = path.resolve(
require.resolve('react-native-windows/package.json'),
'..'
);
const config = withMetroConfig(getDefaultConfig(__dirname), {
root,
dirname: __dirname,
});
const baseBlockList = Array.isArray(config.resolver?.blockList)
? config.resolver.blockList
: config.resolver?.blockList
? [config.resolver.blockList]
: [];
config.resolver = {
...config.resolver,
disableHierarchicalLookup: true,
nodeModulesPaths: [path.join(__dirname, 'node_modules')],
extraNodeModules: {
...config.resolver?.extraNodeModules,
[packageName]: root,
'react': path.join(__dirname, 'node_modules/react'),
'react-native': path.join(__dirname, 'node_modules/react-native'),
},
blockList: [
...baseBlockList,
new RegExp(
`${path.resolve(__dirname, 'windows').replace(/[/\\]/g, '/')}.*`
),
new RegExp(`${rnwPath.replace(/[/\\]/g, '/')}/build/.*`),
new RegExp(`${rnwPath.replace(/[/\\]/g, '/')}/target/.*`),
/.*\.ProjectImports\.zip/,
],
};
module.exports = config;