Skip to content

Remove loadCommunityMiddleware from community-cli-plugin - #59665

Open
huntie wants to merge 1 commit into
pr59663from
pr59664
Open

huntie wants to merge 1 commit into
pr59663from
pr59664

Conversation

@huntie

@huntie huntie commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Context

Migration of the remaining core dev server endpoints from @react-native-community/cli-server-api into core (community-cli-plugin).

This diff

Stop loading createDevServerMiddleware from @react-native-community/cli, and delete the implicit @react-native-community/cli dependency, now that core serves every endpoint apps and tools use. The dev server no longer depends on the CLI at runtime.

Paired with react-native-community/cli#2879, which removes the cli-server-api package.

Net changes

  • start no longer serves the CLI's index page, /systrace, or files under the watch folders by path.
  • start no longer warns when @react-native-community/cli is missing.
  • On iOS, RCTBundleURLProvider's resourceURLForResourceRoot:resourceName:resourceExtension:offlineBundle: builds a /<root>/<name>.<ext> URL that start no longer serves, since only the CLI's watch folder serving answered it. Nothing in React Native calls it. Update the dev support docs to match.

Removed routes

Request Why
GET / (index page) Answers a static "Welcome to React Native" page. Nothing in React Native or its tooling requests it.
GET /package.json (watch folder file) Serves any file under the project at its path. Apps and DevTools load sources and assets through Metro's own routes (/[metro-project]/, /assets/), and the DevTools frontend comes from /debugger-frontend.
GET /Gemfile (outside Metro's source extensions) Exposes project files that Metro itself does not serve to any client that can reach the dev server.
POST /systrace Undocumented and currently broken. Nothing in React Native posts to it.

Changelog:
[General][Removed] - Dev server: Stop serving project files from watch folders (these should use /[metro-project]/ and /assets/ instead), remove index and /systrace endpoints

Test Plan

yarn jest packages/community-cli-plugin

✅ 69 tests pass. Flow and ESLint clean.

End to end: RNTester on iPhone 18 Pro (iOS 27.0) against Metro on port 8088. Before: the previous commit in this stack, with the npm CLI (21.0.0-alpha.1). After: this commit, with start run from a CLI build of the paired CLI change, which removes cli-server-api and the createDevServerMiddleware export.

Removed routes:

Request Before After
GET / (index page) 200 HTML 404
GET /package.json (watch folder file) 200 404
GET /Gemfile (outside Metro's source extensions) 200 404
POST /systrace ❗ Already broken: 500: req.rawBody is never set, so the write throws 404
/package.json, before /package.json, after /, before /, after
The CLI serves the file from the project root 404: no route serves project files by path The CLI's static index page 404: no route answers /

Everything else, after:

  • ✅ RNTester loads its bundle; /status answers 200 with RNTester's project root.
  • ✅ A devMenu broadcast on /message (as the d key sends) opens the Dev Menu; /reload answers OK; /events accepts a connection.
  • ✅ /open-stack-frame for RNTesterAppShared.js answers 200 and launches $REACT_EDITOR with the file; for /etc/hosts, 400.
  • ✅ A cross-origin request gets 403.
  • ✅ /debugger-frontend/rn_fusebox.html answers 200, and /json/list lists the RNTester target.
  • ✅ Metro's own /[metro-project]/js/RNTesterApp.ios.js answers 200, and the source map embeds all 905 sources, so DevTools needs no project file by path.
  • ✅ No "Unable to find @react-native-community/cli" warning in the Metro log.
  • ✅ Dev Menu → Open DevTools launches React Native DevTools, which connects to RNTester and shows its sources.
Loaded Dev Menu over /message
The bundle loads from Metro and the app connects with no CLI middleware A devMenu broadcast on /message, as the d key sends, opens the Dev Menu
Dev Menu → Open DevTools
React Native DevTools connects to RNTester; the Sources panel loads AlertExample.js through the source map

@huntie
huntie changed the base branch from main to pr59663 October 30, 2026 11:30
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 30, 2026
@huntie
huntie added this pull request to stack #59664 October 30, 2026 11:31
@huntie
huntie marked this pull request as ready for review October 30, 2026 12:01

This branch has not been deployed

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Expo Partner: Expo Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant