iOS: prebuilt React, ReactNativeDependencies and hermesvm frameworks ship unstripped, adding 9.3 MB to Release apps

未關閉
#59,772 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 2 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
48/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
ios, macos, react-native

研究方向

Start by tracing how the Release iOS framework artifacts for React Native 0.88.1 and Hermes are linked and packaged; the issue does not name the relevant build files or entry points. Run the supplied macOS reproducer against the published artifacts and compare the binary sizes before and after strip -x. Done means the shipped Release frameworks no longer retain the removable symbols and debug map described in the issue.

由索引模型根據 Issue 內容生成。

描述

Needs: Attention Needs: Repro Platform: iOS
Description

The Release artifacts of the prebuilt iOS frameworks keep their local symbols and a debug map, and an app's Release archive embeds them as they are. strip -x removes 9.3 MB, 48% of the three binaries (ios-arm64 slice, React Native 0.88.1):

Framework Published After strip -x
React 11,894,280 6,370,280 (-46%)
hermesvm 6,360,048 3,002,976 (-53%)
ReactNativeDependencies 1,258,544 828,712 (-34%)

The debug maps point to object files on the build machine, such as /Users/runner/work/react-native/react-native/packages/react-native/.build/output/spm/Release/Build/Intermediates.noindex/... and /Users/runner/work/hermes/hermes/build_iphoneos/.... The artifacts ship no dSYMs. Our app uses the prebuilt frameworks, the default in 0.88. In its Xcode archive the three binaries are byte-identical to the published ones, because Xcode strips only the targets it builds.

Likely cause: the Release artifacts are linked without the strip step that an Xcode archive applies to its own targets.

Related: meta/hermes#1920 (hermesvm size against the 15 MB App Clip limit).

We found this while tracking the Release sizes of the React Native example apps of Evolu (https://evolu.dev), a local-first platform.

Steps to reproduce

On macOS, run:

base=https://repo.reactnative.dev/maven2/com/facebook
for path in \
  react/react-native-artifacts/0.88.1/react-native-artifacts-0.88.1-reactnative-core-release.tar.gz \
  react/react-native-artifacts/0.88.1/react-native-artifacts-0.88.1-reactnative-dependencies-release.tar.gz \
  hermes/hermes-ios/260318099.0.5/hermes-ios-260318099.0.5-hermes-ios-release.tar.gz; do
  dir=$(mktemp -d) && curl -sSfL "$base/$path" | tar -xz -C "$dir"
  for framework in $(find "$dir" -path '*/ios-arm64/*.framework' -type d); do
    binary="$framework/$(basename "$framework" .framework)"
    cp "$binary" "$dir/stripped" && strip -x "$dir/stripped"
    echo "$(basename "$binary"): $(stat -f %z "$binary") -> $(stat -f %z "$dir/stripped") bytes after strip -x"
  done
done
React Native Version

0.88.1

Affected Platforms

Runtime - iOS, Build - MacOS

Output of npx @react-native-community/cli info
Not app-specific: the script reads the published Maven artifacts. macOS 26.6.2, Xcode 27.2.
Stacktrace or Logs
React: 11894280 -> 6370280 bytes after strip -x
ReactNativeDependencies: 1258544 -> 828712 bytes after strip -x
hermesvm: 6360048 -> 3002976 bytes after strip -x
MANDATORY Reproducer

The script in Steps to reproduce: it reads the published artifacts, no app needed

Screenshots and Videos

No response

主要語言
C++
星號
127k
分支
25.5k
平均合併
3 天 18 小時
30 天內合併 PR
188

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

react/react-native 的其他 Issue

查看 react/react-native 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。