40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
const path = require("path");
|
|
const { getDefaultConfig, mergeConfig } = require("@react-native/metro-config");
|
|
|
|
const defaultConfig = getDefaultConfig(__dirname);
|
|
const { assetExts, sourceExts } = defaultConfig.resolver;
|
|
|
|
/**
|
|
* Metro configuration
|
|
* http://reactnative.dev/docs/metro
|
|
*
|
|
* @type {import('metro-config').MetroConfig}
|
|
*/
|
|
const config = {
|
|
transformer: {
|
|
babelTransformerPath: require.resolve(
|
|
"react-native-svg-transformer/react-native"
|
|
)
|
|
},
|
|
resolver: {
|
|
assetExts: assetExts.filter((ext) => ext !== "svg"),
|
|
sourceExts: [...sourceExts, "svg"],
|
|
blockList: [
|
|
// Exclude native Android build artifacts that are created/deleted
|
|
// during Gradle builds, which crash Metro's file watcher (ENOENT)
|
|
/node_modules\/.*\/android\/\.cxx\/.*/,
|
|
/node_modules\/.*\/android\/build\/.*/,
|
|
/node_modules\/.*\/android\/\.gradle\/.*/,
|
|
]
|
|
},
|
|
watcher: {
|
|
additionalExclusions: [
|
|
// Also exclude from the watcher layer for safety
|
|
"**/android/.cxx/**",
|
|
"**/android/build/**",
|
|
"**/android/.gradle/**",
|
|
]
|
|
}
|
|
};
|
|
|
|
module.exports = mergeConfig(defaultConfig, config); |