forked from forest-watcher/forest-watcher
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmetro.config.js
More file actions
45 lines (42 loc) · 1.77 KB
/
Copy pathmetro.config.js
File metadata and controls
45 lines (42 loc) · 1.77 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
44
45
const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
const path = require('path');
const {
withSentryConfig
} = require("@sentry/react-native/metro");
/**
* Metro configuration
* https://facebook.github.io/metro/docs/configuration
*
* @type {import('metro-config').MetroConfig}
*/
const config = {
resolver: {
blockList: [
// react-native-mbtiles is a local `file:` dependency that ships with its
// own node_modules containing an old react-native (which requires the
// long-removed `create-react-class`). Block both locations:
// 1. The workspace source dir (react-native-mbtiles/node_modules/...)
// 2. The yarn-installed copy (node_modules/react-native-mbtiles/node_modules/...)
new RegExp(
path.resolve(__dirname, 'react-native-mbtiles', 'node_modules').replace(/\//g, '[\\/]') + '[\\/].*'
),
new RegExp(
path.resolve(__dirname, 'node_modules', 'react-native-mbtiles', 'node_modules').replace(/\//g, '[\\/]') + '[\\/].*'
)
],
// react-native/Libraries/Network/XHRInterceptor was removed as a private
// internal module in RN 0.73+. Reactotron's networking plugin still imports
// it directly. extraNodeModules only remaps top-level package names, so use
// resolveRequest to intercept the full sub-path and return a no-op shim.
resolveRequest: (context, moduleName, platform) => {
if (moduleName === 'react-native/Libraries/Network/XHRInterceptor') {
return {
filePath: path.resolve(__dirname, 'app/shims/XHRInterceptor.js'),
type: 'sourceFile',
};
}
return context.resolveRequest(context, moduleName, platform);
},
}
};
module.exports = withSentryConfig(mergeConfig(getDefaultConfig(__dirname), config));