-
Notifications
You must be signed in to change notification settings - Fork 23
/
metro.config.js
58 lines (55 loc) · 1.96 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
// Learn more https://docs.expo.io/guides/customizing-metro
const path = require('path');
const {getDefaultConfig} = require('expo/metro-config');
const {mergeConfig} = require('metro-config');
const defaultSourceExts = require('metro-config/src/defaults/defaults').sourceExts;
const defaultAssetExts = require('metro-config/src/defaults/defaults').assetExts;
const defaultConfig = getDefaultConfig(__dirname);
/** @type {import('expo/metro-config').MetroConfig} */
const config = {
transformer: {
assetPlugins: ['expo-asset/tools/hashAssetFiles'],
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
babelTransformerPath: require.resolve('react-native-svg-transformer'),
minifierConfig: {
keep_classnames: true, // enable to fix typeorm
keep_fnames: true, // enable to fix typeorm
mangle: {
toplevel: false,
keep_classnames: true, // enable to fix typeorm
keep_fnames: true, // enable to fix typeorm
},
output: {
ascii_only: true,
quote_style: 3,
wrap_iife: true,
},
sourceMap: {
includeSources: true,
},
toplevel: false,
compress: {
reduce_funcs: false,
},
},
},
resolver: {
assetExts: defaultAssetExts.filter(ext => ext !== 'svg'),
sourceExts: [...defaultSourceExts, 'svg', 'cjs', 'json'],
extraNodeModules: {
// shim: path.resolve(__dirname, 'shim.js'),
// 'react-native-quick-crypto': require.resolve('@sphereon/react-native-quick-crypto'),
buffer: require.resolve('@craftzdog/react-native-buffer'),
stream: require.resolve('readable-stream'),
crypto: require.resolve('react-native-crypto'), // require.resolve('@sphereon/react-native-quick-crypto'),
fs: require.resolve('expo-fs'),
path: require.resolve('path-browserify'),
},
},
};
module.exports = mergeConfig(defaultConfig, config);