Bluesky app fork with some witchin' additions 馃挮
witchsky.app
bluesky
fork
client
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 (moduleName === '@easrng/tr58') {
39 return context.resolveRequest(
40 context,
41 '@easrng/tr58/dist/index.js',
42 platform,
43 )
44 }
45 if (process.env.BSKY_PROFILE) {
46 if (moduleName.endsWith('ReactNativeRenderer-prod')) {
47 return context.resolveRequest(
48 context,
49 moduleName.replace('-prod', '-profiling'),
50 platform,
51 )
52 }
53 }
54 return context.resolveRequest(context, moduleName, platform)
55}
56
57cfg.transformer.getTransformOptions = async () => ({
58 transform: {
59 experimentalImportSupport: true,
60 inlineRequires: true,
61 nonInlinedRequires: [
62 // We can remove this option and rely on the default after
63 // https://github.com/facebook/metro/pull/1390 is released.
64 'React',
65 'react',
66 'react-compiler-runtime',
67 'react/jsx-dev-runtime',
68 'react/jsx-runtime',
69 'react-native',
70 ],
71 },
72})
73
74module.exports = cfg