-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Expand file tree
/
Copy pathmetro.config.ts
More file actions
57 lines (47 loc) · 1.87 KB
/
Copy pathmetro.config.ts
File metadata and controls
57 lines (47 loc) · 1.87 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
46
47
48
49
50
51
52
53
54
55
56
57
// Learn more https://docs.expo.io/guides/customizing-metro
import {type CustomResolver} from '@expo/metro/metro-resolver'
import {getDefaultConfig} from '@expo/metro-config'
import {getSentryExpoConfig} from '@sentry/react-native/metro.js'
const config = getSentryExpoConfig(import.meta.dirname, {
// TODO: confirm this doesn't break anything when we switch to metro web
includeWebReplay: false,
annotateReactComponents: {
textComponentNames: ['Text', 'ButtonText'],
},
getDefaultConfig: (projectRoot, options) => {
const config = getDefaultConfig(projectRoot, options)
if (typeof process.env.RN_SRC_EXT === 'string') {
// inject `.e2e.ts` and `.e2e.tsx` into the sourceExts when running tests)
config.resolver.sourceExts.unshift(...process.env.RN_SRC_EXT.split(','))
}
config.resolver.assetExts = [...config.resolver.assetExts, 'woff2']
if (config.resolver.resolveRequest) {
throw Error('Update this override because it is conflicting now.')
}
if (process.env.BSKY_PROFILE) {
// @ts-expect-error readonly property
config.cacheVersion += ':PROFILE'
const resolver: CustomResolver = (context, moduleName, platform) => {
if (moduleName.endsWith('ReactNativeRenderer-prod')) {
return context.resolveRequest(
context,
moduleName.replace('-prod', '-profiling'),
platform,
)
}
return context.resolveRequest(context, moduleName, platform)
}
// @ts-expect-error readonly property
config.resolver.resolveRequest = resolver
}
config.transformer.getTransformOptions = () =>
Promise.resolve({
transform: {
experimentalImportSupport: true,
inlineRequires: true as false, // ??? typescript why?
},
})
return config as unknown as Record<string, unknown>
},
})
export default config