-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmetro.config.js
More file actions
43 lines (37 loc) · 1.13 KB
/
metro.config.js
File metadata and controls
43 lines (37 loc) · 1.13 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
const path = require('path');
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
const { bundleModeMetroConfig } = require('react-native-worklets/bundleMode');
const root = path.resolve(__dirname, '..');
/**
* Metro configuration
* https://reactnative.dev/docs/metro
*
* @type {import('@react-native/metro-config').MetroConfig}
*/
const pak = require(path.join(root, 'package.json'));
// Peer deps must only resolve from the example app where native modules are linked.
// Block the library root's copies so Metro never picks them up.
const peerDeps = Object.keys(pak.peerDependencies || {});
const blockPatterns = peerDeps.map(
(dep) =>
new RegExp(
'^' +
path.resolve(root, 'node_modules', dep).replace(/[/\\]/g, '[/\\\\]') +
'[/\\\\]'
)
);
const config = {
watchFolders: [root],
resolver: {
nodeModulesPaths: [
path.resolve(__dirname, 'node_modules'),
path.resolve(root, 'node_modules'),
],
blockList: [/(\/__tests__\/.*)$/, ...blockPatterns],
},
};
module.exports = mergeConfig(
getDefaultConfig(__dirname),
bundleModeMetroConfig,
config
);