You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

metro.config.js自定义失效致iOS构建后TestFlight崩溃求助

Metro配置修改被跳过,iOS TestFlight构建崩溃问题排查

我需要在metro.config.js中禁用代码压缩器(minifier),因为iOS应用上传TestFlight后持续崩溃,但开发版本运行正常,推测问题出在代码压缩环节。然而打包过程会忽略所有对metro.config.js的修改,直接跳过该文件,终端提示:"Metro skipped: Project metro.config.js does not match prebuild template."

通过npx expo customize metro.config.js生成的默认配置可以正常运行:

// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require('expo/metro-config');

module.exports = getDefaultConfig(__dirname);

但哪怕只是改成以下形式,Metro都会跳过整个配置文件:

// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require('expo/metro-config');

const config = getDefaultConfig(__dirname);

module.exports = config;

我已查阅Expo官方文档、StackOverflow及GitHub上的多种解决方案,但所有修改均不被接受,打包始终跳过自定义配置文件,烦请帮忙分析原因。


项目依赖:

"dependencies": {
    "@expo/metro-config": "^0.5.2",
    "@expo/webpack-config": "^0.17.0",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-native-community/netinfo": "9.3.0",
    "@react-native-firebase/app": "^16.4.3",
    "@react-native-firebase/messaging": "^16.4.3",
    "@react-navigation/bottom-tabs": "^6.4.0",
    "@react-navigation/drawer": "^6.5.0",
    "@react-navigation/elements": "^1.3.6",
    "@react-navigation/material-top-tabs": "^6.3.0",
    "@react-navigation/native": "^6.0.13",
    "@react-navigation/stack": "^6.3.2",
    "axios": "^1.1.3",
    "date-fns": "^2.29.3",
    "dayjs": "^1.11.6",
    "expo": "~46.0.19",
    "expo-av": "~12.0.4",
    "expo-device": "~4.3.0",
    "expo-file-system": "~14.1.0",
    "expo-linking": "~3.2.2",
    "expo-localization": "~13.1.0",
    "expo-location": "~14.3.0",
    "expo-notifications": "~0.16.1",
    "expo-secure-store": "~11.3.0",
    "expo-splash-screen": "~0.16.2",
    "expo-status-bar": "~1.4.0",
    "expo-task-manager": "~10.3.0",
    "i18n-js": "^4.2.0",
    "react": "18.0.0",
    "react-dom": "18.0.0",
    "react-native": "0.69.6",
    "react-native-gesture-handler": "~2.5.0",
    "react-native-gifted-chat": "^1.0.4",
    "react-native-image-picker": "^4.10.0",
    "react-native-image-zoom-viewer": "^3.0.1",
    "react-native-maps": "0.31.1",
    "react-native-pager-view": "5.4.24",
    "react-native-paper": "^4.12.5",
    "react-native-reanimated": "~2.9.1",
    "react-native-reanimated-carousel": "^3.1.5",
    "react-native-safe-area-context": "4.3.1",
    "react-native-screens": "~3.15.0",
    "react-native-tab-view": "^3.3.0",
    "react-native-vector-icons": "^9.2.0",
    "react-native-web": "~0.18.7",
    "react-redux": "^8.0.5",
    "react-timer-hook": "^3.0.5",
    "redux": "^4.2.0",
    "socket.io-client": "^4.5.3",
    "use-debounce": "^8.0.4",
    "use-elapsed-time": "^3.0.4"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "babel-plugin-module-resolver": "^4.1.0"
  }

内容的提问来源于stack exchange,提问作者elmartino

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.07 06:15:44