$npx -y skills add vercel/next.js --skill react-syncBuild local React changes in the bundle variants consumed by Next.js, sync them into a local Next.js checkout, and test the resulting integration. Use when working on React changes that need validation in Next.js, or when asked to run buildForNext, pnpm sync-react, or synchronize
| 1 | # Sync React to Next.js |
| 2 | |
| 3 | Use this skill when syncing a local React checkout into this Next.js checkout. |
| 4 | |
| 5 | ## Build and sync |
| 6 | |
| 7 | 1. Build React from its own checkout. Pass this skill's script by its absolute |
| 8 | path, because the working directory must be the React repository. |
| 9 | |
| 10 | ```bash |
| 11 | cd <react-repo> |
| 12 | bash <next-repo>/.agents/skills/react-sync/scripts/build-for-next.sh |
| 13 | ``` |
| 14 | |
| 15 | This creates `build/oss-stable` and `build/oss-experimental` with the |
| 16 | bundle variants that Next.js consumes. |
| 17 | |
| 18 | 2. Sync the build into Next.js: |
| 19 | |
| 20 | ```bash |
| 21 | cd <next-repo> |
| 22 | PATH="$(dirname "$(command -v corepack)"):$PATH" \ |
| 23 | pnpm sync-react --version <react-repo> |
| 24 | ``` |
| 25 | |
| 26 | Work around a Codex `PATH`-precedence bug by keeping the directory containing |
| 27 | the active Corepack shim first on `PATH`. Codex injects a separate bundled |
| 28 | `pnpm` executable ahead of the user's Corepack shim, and command lookup |
| 29 | happens before Corepack reads the repository's `packageManager` field. The |
| 30 | prefix makes both this command and `sync-react`'s nested `pnpm install` |
| 31 | resolve through Corepack to the repository-pinned pnpm version. Invoking |
| 32 | only the outer command with `corepack pnpm` is insufficient because the |
| 33 | nested command still resolves `pnpm` from `PATH`. |
| 34 | |
| 35 | 3. Inspect the sync result before testing. Preserve unrelated changes in both |
| 36 | checkouts. Rebuild Next.js when required, then run the focused test command |
| 37 | matching the changed behavior. |
| 38 | |
| 39 | ## Related Skills |
| 40 | |
| 41 | - `$react-vendoring` - vendored React runtime and type boundaries after syncing. |