Skip to content

fix(馃摝): mark the Apple binary packages as optional dependencies - #4042

Open
ForestSpark wants to merge 3 commits into
Shopify:mainfrom
ForestSpark:optional-apple-binaries
Open

ForestSpark wants to merge 3 commits into
Shopify:mainfrom
ForestSpark:optional-apple-binaries

Conversation

@ForestSpark

Copy link
Copy Markdown

Follow-up to #4005, built on top of it (its two commits are included, the diff shrinks once it lands).

Every install downloads all four binary packages, about 750 MB. The three Apple ones are about 525 MB and only Xcode reads them, so Linux and Windows installs (web or Android CI) cannot use them.

This moves react-native-skia-apple-ios, -macos and -tvos to optionalDependencies. Android stays a hard dependency because Gradle runs everywhere. The Graphite swap in the release workflow keeps the same split via graphiteOptionalDependencies, yarn.lock records the optional flags, and the podspec hint and install docs mention that --omit=optional now also skips the iOS package.

The skip only kicks in once the packages declare "os": ["darwin"] (wcandillon/react-native-skia-binaries#8) and the pins here are bumped. Then Linux and Windows get only the Android package and Mac installs do not change. Until that bump the only visible change is for --omit=optional installs, which lose the Apple binaries. The pins are exact, so order does not matter. Docs for the per-OS behaviour will come with the pin bump.

Tested on npm 10.9.4 and Yarn 4.18.0: both skip an optional package whose os does not match, also one level down the tree, and a Linux-made package-lock.json still installs it on a Mac with npm ci. Yarn only evaluates os behind optional edges, so it needs this move too.

Spencer-Yoder and others added 3 commits September 2, 2026 18:40
The podspec raises if `libs/macos` is missing, even when only iOS is being
built. tvOS already handles its own absence gracefully a few lines below, so
the two platforms behave inconsistently for the same condition.

This matters for iOS-only apps. The `react-native-skia-apple-*` binaries are
declared as hard `dependencies`, so every consumer downloads all of them. An
iOS-only app can never use the macOS or tvOS xcframeworks, but pruning them
with an override is blocked by the raise.

Make macOS mirror the existing tvOS handling: fall back to an empty
`vendored_frameworks` list when `libs/macos` is absent, and only hard-fail
when `libs/ios` is missing. The error still fires for the case it was written
for - a consumer who never ran `yarn install`, where `libs/ios` is also
absent. No behaviour change when the packages are present, since libs/macos
then exists and the original path is taken.

Also document the npm-side story, which was previously a single sentence:
which prebuilt packages exist, which can be pruned and how, and why
react-native-skia-apple-ios, react-native-skia-android and canvaskit-wasm
cannot. Clarifies that these packages affect node_modules and install time
but not shipped app size, which is a recurring source of confusion.
The three react-native-skia-apple-* packages are only read by Xcode, which
runs on macOS. Listing them as optionalDependencies lets package managers
skip them on Linux and Windows once the packages declare os: [darwin],
instead of downloading ~525 MB of xcframeworks those hosts cannot use.
react-native-skia-android stays a hard dependency because Gradle runs on
every OS.

The release workflow's Graphite swap keeps the same split via the new
graphiteOptionalDependencies field, and the podspec hint mentions that
--omit=optional now also drops the iOS binaries.
@ForestSpark

Copy link
Copy Markdown
Author

I have signed the CLA!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants