forked from valora-inc/wallet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmetro.config.js
40 lines (38 loc) · 1.44 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
const path = require('path')
const nodeLibs = require('node-libs-react-native')
const exclusionList = require('metro-config/src/defaults/exclusionList')
const escapeStringRegexp = require('escape-string-regexp')
const isE2E = process.env.CELO_TEST_CONFIG === 'e2e'
const root = path.resolve(__dirname)
const escapedRoot = escapeStringRegexp(root)
const blist = []
const defaultSourceExts = require('metro-config/src/defaults/defaults').sourceExts
const defaultAssetExts = require('metro-config/src/defaults/defaults').assetExts
module.exports = {
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: true,
},
}),
},
resolver: {
assetExts: [...defaultAssetExts, 'txt'],
blacklistRE: exclusionList(
isE2E ? blist : blist.concat([RegExp(`${escapedRoot}\/e2e\/mocks/.*`)])
),
extraNodeModules: {
...nodeLibs,
fs: require.resolve('react-native-fs'),
'isomorphic-fetch': require.resolve('cross-fetch'),
// We don't need the `net` module for now.
// This doesn't actually provide any implementation,
// but avoids an error when require('net') is used (in ContractKit for instance).
net: require.resolve('node-libs-react-native/mock/net'),
vm: require.resolve('vm-browserify'),
},
sourceExts: isE2E ? ['e2e.ts', 'e2e.js'].concat(defaultSourceExts) : defaultSourceExts,
},
watchFolders: [root],
}