This repository has been archived by the owner on Feb 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
metro.config.js
63 lines (58 loc) · 1.91 KB
/
metro.config.js
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
58
59
60
61
62
63
const { getDefaultConfig } = require('metro-config')
// If developing locally and using yalc
// to manage local audius-client dependency,
// change this to '.yalc'
const AUDIUS_CLIENT_LOCATION = 'node_modules'
const clientPath = path =>
`${__dirname}/${AUDIUS_CLIENT_LOCATION}/audius-client/src/${path}`
module.exports = (async () => {
const {
resolver: { sourceExts, assetExts }
} = await getDefaultConfig()
return {
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: true,
inlineRequires: true
}
}),
babelTransformerPath: require.resolve('react-native-svg-transformer')
},
resolver: {
assetExts: assetExts.filter(ext => ext !== 'svg'),
sourceExts: [...sourceExts, 'svg', 'cjs'],
extraNodeModules: {
// Alias for 'src' to allow for absolute paths
app: `${__dirname}/src`,
// This is used to resolve the absolute paths found in audius-client.
// Eventually all shared state logic will live in @audius/client-common
// and this can be removed
...[
'assets',
'audio',
'common',
'pages',
'models',
'schemas',
'services',
'store',
'utils',
'workers'
].reduce(
(result, current) => ({ ...result, [current]: clientPath(current) }),
{}
),
// Some modules import native node modules without necessarily using them.
// This mocks them out so the app can build
crypto: `${__dirname}/node_modules/expo-crypto`,
fs: `${__dirname}/node_modules/react-native-fs`,
child_process: `${__dirname}/src/mocks/empty.ts`,
http: `${__dirname}/src/mocks/empty.ts`,
https: `${__dirname}/src/mocks/empty.ts`,
stream: `${__dirname}/src/mocks/empty.ts`
}
},
maxWorkers: 2
}
})()