From 082ab7aa62777e0923694f44b47d8269238d75c6 Mon Sep 17 00:00:00 2001 From: Alex Hunt Date: Fri, 26 Jun 2026 11:41:34 -0700 Subject: [PATCH] Move Community CLI discovery config into plugin package MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Self-register commands from the `community-cli-plugin` package via `react-native.config.js` — meaning we can remove the redirect within `packages/react-native/react-native.config.js`. Progress towards removing `community-cli-plugin` as a direct dep of `react-native`, and paired with https://github.com/react-native-community/template/pull/235. Changelog: [General][Breaking] - `react-native/community-cli-plugin` will no longer be auto-detected from `react-native`. It must now be specified in `devDependencies`. Differential Revision: D109869538 --- packages/community-cli-plugin/package.json | 3 ++- .../react-native.config.js | 18 ++++++++++++++++++ packages/react-native/react-native.config.js | 7 ------- 3 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 packages/community-cli-plugin/react-native.config.js diff --git a/packages/community-cli-plugin/package.json b/packages/community-cli-plugin/package.json index 966a8e8385d7..e78407a4513f 100644 --- a/packages/community-cli-plugin/package.json +++ b/packages/community-cli-plugin/package.json @@ -25,7 +25,8 @@ } }, "files": [ - "dist" + "dist", + "react-native.config.js" ], "scripts": { "prepack": "node ../../scripts/build/prepack.js" diff --git a/packages/community-cli-plugin/react-native.config.js b/packages/community-cli-plugin/react-native.config.js new file mode 100644 index 000000000000..6d3241d4b1a3 --- /dev/null +++ b/packages/community-cli-plugin/react-native.config.js @@ -0,0 +1,18 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + * @noflow + */ + +const { + bundleCommand, + startCommand, +} = require('@react-native/community-cli-plugin'); + +module.exports = { + commands: [bundleCommand, startCommand], +}; diff --git a/packages/react-native/react-native.config.js b/packages/react-native/react-native.config.js index 713290231165..ec16dec0dab4 100644 --- a/packages/react-native/react-native.config.js +++ b/packages/react-native/react-native.config.js @@ -70,13 +70,6 @@ try { const commands /*: Array */ = []; -const { - bundleCommand, - startCommand, -} = require('@react-native/community-cli-plugin'); - -commands.push(bundleCommand, startCommand); - const codegenCommand /*: Command */ = { name: 'codegen', options: [