Skip to content

breaking: Bundle iOS and Android as core platforms - #2817

Merged
thymikee merged 1 commit into
react-native-community:mainfrom
huntie:cli-core-platform-plugins
Sep 25, 2026
Merged

thymikee merged 1 commit into
react-native-community:mainfrom
huntie:cli-core-platform-plugins

Conversation

@huntie

@huntie huntie commented Jun 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Bundle cli-platform-android and cli-platform-ios in the main @react-native-community/cli package.

Relates to this proposed change: react-native-community/template#235

Motivation

Simplify Community CLI setup for users (see above). iOS and Android are first-class RN platforms.

  • While the CLI was historically separated out into granular plugins, I don't believe we need to be so aggressive in splitting the core Android and iOS platforms into separate installs. This optimisation provides little value when RN itself bundles both — match this baseline.
    • Other plugins, including OOT platforms, remain selectively applied via plugin discovery. Again, the redundant weight of ~20 scripts (each way) being omitted for a single platform repo is a marginal win. The convention (in the case of libraries) is that OOT platform support is additional.
    • We can always un-bundle later (in a hypothetical project where RN also separates core from platforms).
  • Prior art: Expo CLI doesn't bother separating platforms — the dev install impact on projects is negligible. No related artifacts leak into the project.

Notes

  • loadConfig and loadConfigAsync gain an optional platforms argument that seeds the config. Project and dependency configs still layer on top and can override it, and the --platform filter is honoured.
  • react-native is never linked as a dependency. It stayed out of autolinking only because its own react-native.config.js declared platforms, which the paired React Native change deletes.
  • Running start, bundle, codegen, or spm without @react-native/community-cli-plugin installed exits with an error naming the package to add, rather than Commander's bare unknown command.

Changelog

  • Breaking: The CLI now includes the iOS and Android platforms, so their commands (such as run-ios and run-android) are always available. Projects no longer need @react-native-community/cli-platform-ios or @react-native-community/cli-platform-android.
  • Breaking: From React Native 0.89, start and bundle come from @react-native/community-cli-plugin — which must be added to your project's devDependencies.

Test Plan

Linked this branch into a template-shaped app:

  • No react-native.config.js in the project
  • react-native is a local checkout of the paired React Native change, which deletes react-native.config.js from the package
  • @react-native/community-cli-plugin in devDependencies registers bundle, start, spm, and codegen

Built-in platforms (this PR)

  • ✅ @react-native-community/cli-platform-ios resolves from the CLI's own dependencies, not the project
  • ✅ config registers ios and android, and react-native is not autolinked as a dependency
  • ✅ Project config resolves through them: HelloWorld.xcworkspace and com.helloworld
  • ✅ run-ios, build-ios, log-ios, run-android, build-android, and log-android are available
  • ✅ config --platform ios narrows platforms to ios
built-in platforms

Missing @react-native/community-cli-plugin — user warning (plugin removed from the same app)

  • ✅ npx react-native start exits 1 with an error naming the package to add
  • ✅ Covered in __e2e__/unknown.test.ts
missing plugin

RNTester and HelloWorld (paired React Native change, this build linked into the monorepo)

  • ✅ config registers ios and android and resolves each app's project, with no platform config of their own
  • ✅ react-native is absent from config dependencies, the input CocoaPods and SPM autolinking read (SPM setup not rerun locally)
  • ✅ react-native bundle --platform ios completes for RNTester

Checklist

  • Documentation is up to date.
  • Follows commit message convention described in CONTRIBUTING.md.
  • For functional changes, my test plan has linked these CLI changes into a local react-native checkout (instructions).

@huntie

huntie commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator Author

@thymikee Ready for review, pending the corresponding changes in core. Aim to land this for the 0.89 cycle (NOTE: CLI should already have branched on 0.88 so this is to main→0.89).

@thymikee thymikee left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's explicitly note what's breaking, because it's about observable behavior rather than APIs

@huntie
huntie force-pushed the cli-core-platform-plugins branch from d8d1570 to 3a1aed0 Compare September 25, 2026 12:33
@huntie
huntie force-pushed the cli-core-platform-plugins branch from 3a1aed0 to 9e89990 Compare September 25, 2026 12:35
@thymikee
thymikee merged commit 85c2c5d into react-native-community:main Sep 25, 2026
8 checks passed
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