-
Notifications
You must be signed in to change notification settings - Fork 16
/
metro.config.js
42 lines (38 loc) · 1.45 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
/* eslint-disable @typescript-eslint/no-var-requires */
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config')
const path = require('path')
/** @type {import('metro-config').MetroConfig} */
const defaultConfig = getDefaultConfig(__dirname)
const {
resolver: { assetExts, sourceExts },
} = defaultConfig
/** @type {import('metro-config').MetroConfig} */
const config = {
resolver: {
assetExts: assetExts.filter(ext => ext !== 'svg'),
sourceExts: [...sourceExts, 'svg'],
extraNodeModules: {
'build-config-name': path.resolve(
__dirname,
'../build-configs',
process.env.BUILD_CONFIG_NAME || 'integreat-test-cms',
'build-config-name/index.ts',
),
},
nodeModulesPaths: [path.resolve(__dirname, './node_modules')],
// Make sure we use the local copy of react and react-native to avoid multiple copies in the bundle
// https://github.com/facebook/react/issues/13991#issuecomment-830308729
resolveRequest: (context, moduleName, platform) => {
const module =
moduleName === 'react' || moduleName === 'react-native'
? path.join(__dirname, 'node_modules', moduleName)
: moduleName
return context.resolveRequest(context, module, platform)
},
},
watchFolders: [path.resolve(__dirname, '../')],
transformer: {
babelTransformerPath: require.resolve('react-native-svg-transformer'),
},
}
module.exports = mergeConfig(defaultConfig, config)