Bluesky app fork with some witchin' additions 馃挮
witchsky.app
bluesky
fork
1// Learn more https://docs.expo.io/guides/customizing-metro
2const {getSentryExpoConfig} = require('@sentry/react-native/metro')
3const cfg = getSentryExpoConfig(__dirname)
4
5cfg.resolver.sourceExts = process.env.RN_SRC_EXT
6 ? process.env.RN_SRC_EXT.split(',').concat(cfg.resolver.sourceExts)
7 : cfg.resolver.sourceExts
8
9if (cfg.resolver.resolveRequest) {
10 throw Error('Update this override because it is conflicting now.')
11}
12
13if (process.env.BSKY_PROFILE) {
14 cfg.cacheVersion += ':PROFILE'
15}
16
17cfg.resolver.assetExts = [...cfg.resolver.assetExts, 'woff2']
18
19// Enabled by default in RN 0.79+, but this breaks Lingui + others
20cfg.resolver.unstable_enablePackageExports = false
21
22cfg.resolver.resolveRequest = (context, moduleName, platform) => {
23 // HACK: manually resolve a few packages that use `exports` in `package.json`.
24 // A proper solution is to enable `unstable_enablePackageExports` but this needs careful testing.
25 if (moduleName.startsWith('multiformats/hashes/hasher')) {
26 return context.resolveRequest(
27 context,
28 'multiformats/cjs/src/hashes/hasher',
29 platform,
30 )
31 }
32 if (moduleName.startsWith('multiformats/cid')) {
33 return context.resolveRequest(context, 'multiformats/cjs/src/cid', platform)
34 }
35 if (moduleName === '@ipld/dag-cbor') {
36 return context.resolveRequest(context, '@ipld/dag-cbor/src', platform)
37 }
38 if (process.env.BSKY_PROFILE) {
39 if (moduleName.endsWith('ReactNativeRenderer-prod')) {
40 return context.resolveRequest(
41 context,
42 moduleName.replace('-prod', '-profiling'),
43 platform,
44 )
45 }
46 }
47 return context.resolveRequest(context, moduleName, platform)
48}
49
50cfg.transformer.getTransformOptions = async () => ({
51 transform: {
52 experimentalImportSupport: true,
53 inlineRequires: true,
54 nonInlinedRequires: [
55 // We can remove this option and rely on the default after
56 // https://github.com/facebook/metro/pull/1390 is released.
57 'React',
58 'react',
59 'react-compiler-runtime',
60 'react/jsx-dev-runtime',
61 'react/jsx-runtime',
62 'react-native',
63 ],
64 },
65})
66
67module.exports = cfg