-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathmetro.config.js
More file actions
40 lines (31 loc) · 1.29 KB
/
metro.config.js
File metadata and controls
40 lines (31 loc) · 1.29 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
const { getDefaultConfig } = require('@react-native/metro-config');
const { mergeConfig } = require('metro-config');
const path = require('path');
const exclusionList = require('metro-config/private/defaults/exclusionList').default;
const escape = require('escape-string-regexp');
// Gesture handler tries to require 'react-native-reanimated' inside a try...catch
// block. In root directory, we have reanimated installed but FabricExample doesn't.
// We need to blacklist reanimated to prevent its JS code from bein in the bundle
// without the native code or the babel plugin.
const modulesBlacklist = ['react-native-reanimated'];
const projectRoot = __dirname;
const monorepoRoot = path.resolve(projectRoot, '../..');
const config = getDefaultConfig(__dirname);
config.watchFolders = [monorepoRoot];
config.resolver.nodeModulesPaths = [
path.resolve(projectRoot, 'node_modules'),
path.resolve(monorepoRoot, 'node_modules'),
];
config.resolver.blacklistRE = exclusionList(
modulesBlacklist.map(
(m) =>
new RegExp(`^${escape(path.join(monorepoRoot, 'node_modules', m))}\\/.*$`)
)
);
config.transformer.getTransformOptions = async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: true,
},
});
module.exports = mergeConfig(getDefaultConfig(__dirname), config);