From e0be2efe4e80edf99f96a2ae6a25856f6df5e0ca Mon Sep 17 00:00:00 2001 From: Blake Friedman Date: Wed, 6 Nov 2024 07:26:30 -0800 Subject: [PATCH] fix/cli start (#47450) Summary: When decoupling the community-cli-plugin from the react-native-community/cli-server-api (https://github.com/facebook/react-native/issues/45311), a middleware stub was created to allow a runtime stub to be used in this case. This middleware should be used so as not to break when the optional cli-server-api dependency isn't present. Changelog: [General][Fixed] - Fix npm react-native start when cli-server-api isn't installed Pull Request resolved: https://github.com/facebook/react-native/pull/47450 Test Plan: Forced a runtime exception simulating the package not being dependent and was able to build rn-tester. ![CleanShot 2024-11-06 at 10 49 58@2x](https://github.com/user-attachments/assets/c040ec5b-7000-43bd-ba54-52a672ff3675) Reviewed By: cipolleschi Differential Revision: D65532486 Pulled By: blakef fbshipit-source-id: 2b380607de63ac2da906ef0cb1e48b9ef263cb68 --- .../community-cli-plugin/src/commands/start/runServer.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/community-cli-plugin/src/commands/start/runServer.js b/packages/community-cli-plugin/src/commands/start/runServer.js index 512255e8cba..ce4f7bcd9de 100644 --- a/packages/community-cli-plugin/src/commands/start/runServer.js +++ b/packages/community-cli-plugin/src/commands/start/runServer.js @@ -19,10 +19,7 @@ import isDevServerRunning from '../../utils/isDevServerRunning'; import loadMetroConfig from '../../utils/loadMetroConfig'; import * as version from '../../utils/version'; import attachKeyHandlers from './attachKeyHandlers'; -import { - createDevServerMiddleware, - indexPageMiddleware, -} from '@react-native-community/cli-server-api'; +import {createDevServerMiddleware, indexPageMiddleware} from './middleware'; import {createDevMiddleware} from '@react-native/dev-middleware'; import chalk from 'chalk'; import Metro from 'metro';