-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
metro.config.js
43 lines (40 loc) · 1.21 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
/* eslint-disable import/no-commonjs */
/**
* Metro configuration for React Native
* https://github.com/facebook/react-native
*
* @type {import('metro-config').MetroConfig}
*/
const { getDefaultConfig } = require('expo/metro-config');
const { mergeConfig } = require('@react-native/metro-config');
module.exports = function (baseConfig) {
const defaultConfig = mergeConfig(baseConfig, getDefaultConfig(__dirname));
const {
resolver: { assetExts, sourceExts },
} = defaultConfig;
return mergeConfig(defaultConfig, {
resolver: {
assetExts: assetExts.filter((ext) => ext !== 'svg'),
sourceExts: [...sourceExts, 'svg', 'cjs', 'mjs'],
resolverMainFields: ['sbmodern', 'react-native', 'browser', 'main'],
},
transformer: {
babelTransformerPath: require.resolve('./metro.transform.js'),
assetPlugins: ['react-native-svg-asset-plugin'],
svgAssetPlugin: {
pngCacheDir: '.png-cache',
scales: [1],
output: {
compressionLevel: 6,
},
},
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: true,
inlineRequires: true,
},
}),
},
resetCache: true,
});
};