forked from expo/expo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmetro.config.js
48 lines (40 loc) · 1.79 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
// Learn more https://docs.expo.dev/guides/customizing-metro/
/* eslint-env node */
const { getDefaultConfig } = require('expo/metro-config');
const path = require('path');
const monorepoRoot = path.join(__dirname, '../..');
const config = getDefaultConfig(__dirname);
config.resolver.assetExts.push(
'db' // See: ../test-suite/assets/asset-db.db
);
config.resolver.blockList = [
// Exclude react-native-lab from haste map.
// Because react-native versions may be different between node_modules/react-native and react-native-lab,
// we should use the one from node_modules for bare-expo.
/\breact-native-lab\/react-native\/node_modules\b/,
// Copied from expo-yarn-workspaces
/\/__tests__\//,
/\/android\/React(Android|Common)\//,
/\/versioned-react-native\//,
];
// To test test-suite from Expo Go, the react-native js source is from our fork.
config.serializer.getPolyfills = () => {
const reactNativeRoot = path.join(
monorepoRoot,
'react-native-lab',
'react-native',
'packages',
'react-native'
);
return require(path.join(reactNativeRoot, 'rn-get-polyfills'))();
};
// Minimize the "watched" folders that Metro crawls through to speed up Metro in big monorepos.
// Note, omitting folders disables Metro from resolving files within these folders
// This also happens when symlinks falls within these folders, but the real location doesn't.
config.watchFolders = [
__dirname, // Allow Metro to resolve all files within this project
path.join(monorepoRoot, 'packages'), // Allow Metro to resolve all workspace files of the monorepo
path.join(monorepoRoot, 'node_modules'), // Allow Metro to resolve "shared" `node_modules` of the monorepo
path.join(monorepoRoot, 'react-native-lab'), // Allow Metro to resolve `react-native-lab/react-native` files
];
module.exports = config;