Skip to content

Conversation

@Saadnajmi
Copy link
Collaborator

@Saadnajmi Saadnajmi commented Jan 22, 2026

Summary:

Backport #2820
Backport #2819
Backport #2822

Test Plan:

CI should pass

tido64 and others added 3 commits January 22, 2026 13:05
…ved correctly (microsoft#2820)

## Summary:

`@react-native-community/cli-platform-apple` is not correctly resolved
in pnpm setups:

```
% DEBUG=react-native yarn build:macos
/~/packages/app/example/node_modules/react-native-macos/react-native.config.js: @react-native-community/cli-platform-apple not found, the react-native.config.js may be unusable.
info Bundling macos...
error Invalid platform "macos" selected.
info Available platforms are: "android", "ios", "windows". If you are trying to bundle for an out-of-tree platform, it may not be installed.
```

## Test Plan:

n/a
## Summary:

macOS bundling fails because it tries to import `chalk` but does not
declare it.

```
/~/packages/app/example/node_modules/react-native-macos/react-native.config.js: node:internal/modules/cjs/loader:1421
  const err = new Error(message);
              ^

Error: Cannot find module 'chalk'
Require stack:
- /~/node_modules/.store/react-native-macos-virtual-89732d1908/package/local-cli/runMacOS/runMacOS.js
- /~/node_modules/.store/react-native-macos-virtual-89732d1908/package/react-native.config.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1421:15)
    at defaultResolveImpl (node:internal/modules/cjs/loader:1059:19)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1064:22)
    at Module._load (node:internal/modules/cjs/loader:1227:37)
    at TracingChannel.traceSync (node:diagnostics_channel:328:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:245:24)
    at Module.require (node:internal/modules/cjs/loader:1504:12)
    at require (node:internal/modules/helpers:152:16)
    at Object.<anonymous> (/~/node_modules/.store/react-native-macos-virtual-89732d1908/package/local-cli/runMacOS/runMacOS.js:38:15)
    at Module._compile (node:internal/modules/cjs/loader:1761:14) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/~/node_modules/.store/react-native-macos-virtual-89732d1908/package/local-cli/runMacOS/runMacOS.js',
    '/~/node_modules/.store/react-native-macos-virtual-89732d1908/package/react-native.config.js'
  ]
}
```

Instead of adding `chalk` as a dependency (and introducing a diff), we
inline the functions we use.

## Test Plan:

n/a
@Saadnajmi Saadnajmi requested a review from a team as a code owner January 22, 2026 21:07
@Saadnajmi Saadnajmi merged commit e43ee17 into microsoft:0.81-stable Jan 22, 2026
13 checks passed
@Saadnajmi Saadnajmi deleted the 0.81/backports branch January 22, 2026 23:09
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.

4 participants