-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathmetro.config.js
More file actions
43 lines (36 loc) · 1.41 KB
/
metro.config.js
File metadata and controls
43 lines (36 loc) · 1.41 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
// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require('expo/metro-config');
const path = require('path');
const monorepoRoot = path.resolve(__dirname, '../..');
/** @type {import('expo/metro-config').MetroConfig} */
const config = getDefaultConfig(__dirname);
const { transformer, resolver } = config;
config.watchFolders = [monorepoRoot];
config.transformer = {
...transformer,
babelTransformerPath: require.resolve('react-native-svg-transformer/expo'),
};
config.resolver = {
...resolver,
assetExts: resolver.assetExts.filter((ext) => ext !== 'svg'),
sourceExts: [...resolver.sourceExts, 'svg'],
nodeModulesPaths: [
path.resolve(__dirname, 'node_modules'),
path.resolve(monorepoRoot, 'node_modules'),
],
// Always resolve react and react-native from the monorepo root so that
// workspace packages with their own nested node_modules (e.g.
// packages/react-native-executorch/node_modules/react) don't create a
// second React instance and trigger "Invalid hook call".
resolveRequest: (context, moduleName, platform) => {
if (moduleName === 'react' || moduleName === 'react-native') {
return {
filePath: require.resolve(moduleName, { paths: [monorepoRoot] }),
type: 'sourceFile',
};
}
return context.resolveRequest(context, moduleName, platform);
},
};
config.resolver.assetExts.push('pte');
module.exports = config;