-
Notifications
You must be signed in to change notification settings - Fork 463
Expand file tree
/
Copy pathmetro.config.js
More file actions
35 lines (27 loc) · 1.12 KB
/
Copy pathmetro.config.js
File metadata and controls
35 lines (27 loc) · 1.12 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
const path = require('path');
const { getDefaultConfig } = require('expo/metro-config');
const projectRoot = __dirname;
const libraryRoot = path.resolve(projectRoot, '..');
/** @type {import('expo/metro-config').MetroConfig} */
const config = getDefaultConfig(projectRoot);
// Watch the library source so changes are picked up live
config.watchFolders = [libraryRoot];
// Only resolve node_modules from the example to avoid duplicate React
config.resolver.nodeModulesPaths = [
path.resolve(projectRoot, 'node_modules'),
];
// Map the library and its runtime dep to the actual locations
config.resolver.extraNodeModules = {
'react-native-markdown-renderer': libraryRoot,
'markdown-it': path.resolve(libraryRoot, 'node_modules', 'markdown-it'),
};
// Allow importing .md files as assets
config.resolver.assetExts.push('md');
// Block the library's node_modules for packages the example already provides
config.resolver.blockList = [
new RegExp(
path.resolve(libraryRoot, 'node_modules').replace(/[/\\]/g, '[/\\\\]') +
'[\\/\\\\](react|react-native|react-native-web|@react-native)[\\/\\\\].*'
),
];
module.exports = config;