Skip to content

Commit b901cec

Browse files
Saadnajmiclaude
andcommitted
fix(0.81): use yarn pack + yarn add to match normal install flow
Replace npm install --install-links with yarn pack + yarn add. npm install <local-path> creates a symlink, and --install-links copies files but without pre-generated codegen headers. Both diverge from a normal user's install in ways that break the build: 1. Symlinks cause Node module instance duplication (bundle.js loads @react-native/metro-config from the monorepo while metro.config.js loads it from the test project — setFrameworkDefaults misses). 2. Missing React/FBReactNativeSpec/ headers (generated by prepack.js, shipped in published tarballs). Without them the codegen regenerates, but the upstream react-native's FBReactNativeSpec processes first, creating the directory — then the fork's version is skipped by shouldSkipGenerationForFBReactNativeSpec(), leaving headers without macOS-specific fields (critical, modal, defaultInputs). yarn pack runs the prepack script (generating the codegen headers) and produces a tarball identical to what npm publish would create. yarn add installs it as a regular package — no symlinks, correct headers, matching the normal user flow exactly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7185e9a commit b901cec

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

.github/workflows/microsoft-test-react-native-macos-init.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,15 @@ jobs:
5656
working-directory: ${{ runner.temp }}/testcli
5757
run: |
5858
set -eox pipefail
59-
# --install-links copies the package instead of symlinking it.
60-
# Without this, Node follows the symlink's real path back to the
61-
# monorepo for module resolution, causing bundle.js to load a
62-
# different instance of @react-native/metro-config than the one
63-
# the user's metro.config.js uses. The setFrameworkDefaults()
64-
# call (which registers the "macos" platform) then targets the
65-
# wrong instance, and xcodebuild fails with "Invalid platform".
66-
npm install --install-links ${{ github.workspace }}/packages/react-native
59+
# Pack the local package into a tarball first. This runs the
60+
# "prepack" script which generates the FBReactNativeSpec codegen
61+
# headers (React/FBReactNativeSpec/) that are shipped in published
62+
# releases. Then install from the tarball so the test project
63+
# matches a normal user's node_modules layout: no symlinks (which
64+
# cause module instance duplication) and pre-generated codegen
65+
# headers present (which the build relies on to skip regeneration).
66+
yarn --cwd ${{ github.workspace }}/packages/react-native pack -o ${{ runner.temp }}/react-native-macos.tgz
67+
yarn add ${{ runner.temp }}/react-native-macos.tgz
6768
6869
- name: Apply macOS template
6970
working-directory: ${{ runner.temp }}/testcli

0 commit comments

Comments
 (0)