const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config'); const exclusionList = require('metro-config/private/defaults/exclusionList').default; /* * "Open DevTools" launches React Native DevTools, which is an Electron app * spawned from this process with this process's environment. VS Code sets * ELECTRON_RUN_AS_NODE=1 for everything its extensions start, so a Metro * launched from inside the editor hands that on, and the DevTools app then * runs as plain Node, rejects `--frontendUrl` as a "bad option" and exits. * Nothing opens and the app shows no error. Metro itself is not Electron, so * dropping the variable here costs nothing. */ delete process.env.ELECTRON_RUN_AS_NODE; /** * Metro configuration * https://reactnative.dev/docs/metro * * Native build output (android/app/build alone is >2GB after a debug build) is * excluded from the file crawl. Without watchman installed Metro walks these * directories on startup and never becomes responsive. * * The same crawl runs on every start, and it walks every file that is not * blocked here. @hugeicons/core-free-icons alone ships ~24,000 files — a * CommonJS copy, type definitions and a source map for each of ~6,000 icons — * out of ~70,000 in node_modules. Metro resolves the icons to `dist/esm/*.js` * only, so the rest is skipped. If an icon import ever fails to resolve after * a library upgrade, check these two entries first. * * @type {import('@react-native/metro-config').MetroConfig} */ const config = { resolver: { blockList: exclusionList([ /\/android\/build\/.*/, /\/android\/app\/build\/.*/, /\/android\/\.gradle\/.*/, /\/android\/\.kotlin\/.*/, /\/node_modules\/.*\/android\/build\/.*/, /\/\.cxx\/.*/, /\/ios\/build\/.*/, /\/ios\/Pods\/.*/, /\/node_modules\/@hugeicons\/core-free-icons\/dist\/(cjs|types)\/.*/, /\/node_modules\/@hugeicons\/core-free-icons\/dist\/esm\/.*\.map$/, ]), }, }; module.exports = mergeConfig(getDefaultConfig(__dirname), config);