forked from Nozbe/WatermelonDB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
metro.config.js
51 lines (46 loc) · 1.68 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
const exclusionList = require('metro-config/src/defaults/exclusionList')
const path = require('path')
const glob = require('glob-to-regexp')
const metroCache = require('metro-cache')
const getBlockList = () => {
// ignore dist/, dev/
const defaultPattern = exclusionList([
glob(`${path.resolve(__dirname, '..')}/dist/*`),
glob(`${path.resolve(__dirname, '..')}/dev/*`),
glob(`${path.resolve(__dirname, '..')}/example/*`),
])
.toString()
.slice(1, -1)
// delete __tests__ from the default blacklist
const newPattern = defaultPattern.replace('|\\/__tests__\\/.*', '')
return RegExp(newPattern)
}
const config = {
projectRoot: path.resolve(__dirname),
watchFolders: [
path.resolve(__dirname, 'native'),
path.resolve(__dirname, 'node_modules', '@babel'),
],
resolver: {
extraNodeModules: {
// We need `expect` package for RN integration tests… but the damn thing expects to be in jest
// (Node) environment… so we have to mock a bunch of stuff for this to work
fs: path.resolve(__dirname, 'src/__tests__/emptyMock'),
'graceful-fs': path.resolve(__dirname, 'src/__tests__/emptyMock'),
module: path.resolve(__dirname, 'src/__tests__/emptyMock'),
assert: path.resolve(__dirname, 'src/__tests__/emptyMock'),
stream: path.resolve(__dirname, 'src/__tests__/emptyMock'),
constants: path.resolve(__dirname, 'src/__tests__/emptyMock'),
},
blockList: getBlockList(),
},
transformer: {
babelTransformerPath: path.resolve(__dirname, 'native/metro-transformer.js'),
},
cacheStores: [
new metroCache.FileStore({
root: path.resolve(__dirname, '.cache/metro'),
}),
],
}
module.exports = config