react-vendoring

react-vendoring: React vendoring and the react-server layer boundary. Intended for editing entry-base.ts, $$compiled.internal.d.ts, compiled/react* packages, or the copy_vendor_react step in taskfile.js. Covers the entry-base.ts boundary (all react-server-dom-webpack/* imports must go through that file), the React vendoring channel, type declarations, Turbopack remapping to react-server-dom-turbopack, the ComponentMod access pattern, and ESLint suppression for protected require. Metadata: internal: true.

Last repository push
GitHub Stars
143,631
Forks
32,732
Issues / PRs
4,112

Screenshots

A demonstration from skillπ Lab

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "react-vendoring" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-c31ff4c64111178ef384ee3ebd43957aa337792c4e5e84862c66af2459aeb603. Verify the upstream source and version against https://github.com/vercel/next.js before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

react-vendoring: React vendoring and the react-server layer boundary. Intended for editing entry-base.ts, $$compiled.internal.d.ts, compiled/react* packages, or the copy_vendor_react step in taskfile.js. Covers the entry-base.ts boundary (all react-server-dom-webpack/* imports must go through that file), the React vendoring channel, type declarations, Turbopack remapping to react-server-dom-turbopack, the ComponentMod access pattern, and ESLint suppression for protected require. Metadata: internal: true.

0 Downloads

Introduction source: third_party · vercel · 1.0.0 Reference

SkillPi interpretation

Tasks
Use this skill for changes touching vendored React, `react-server-dom-webpack/*`, or react-server layer boundaries.
Audience
Not specified in the source documentation.
Inputs and outputs
Not specified in the source documentation.
Software, accounts and paid services
Not specified in the source documentation.
Limits and differences
Not specified in the source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: react-vendoring
description: >
  React vendoring and react-server layer boundaries. Use when editing
  entry-base.ts, $$compiled.internal.d.ts, compiled/react* packages,
  or taskfile.js copy_vendor_react. Covers the entry-base.ts boundary
  (all react-server-dom-webpack/* imports must go through it), vendored
  React channels, type declarations, Turbopack remap to
  react-server-dom-turbopack, ComponentMod access patterns, and ESLint
  suppression for guarded requires.
metadata:
  internal: true

React Vendoring

Use this skill for changes touching vendored React, react-server-dom-webpack/*, or react-server layer boundaries.

App Router Vendoring

React is NOT resolved from node_modules for App Router. It's vendored into packages/next/src/compiled/ during pnpm build (task: copy_vendor_react() in taskfile.js). Pages Router resolves React from node_modules normally.

  • Two channels: stable (compiled/react/) and experimental (compiled/react-experimental/). The runtime bundle webpack config aliases to the correct channel via makeAppAliases({ experimental }).

entry-base.ts Boundary

Only entry-base.ts is compiled in rspack's (react-server) layer. ALL imports from react-server-dom-webpack/* (Flight server/static APIs) must go through entry-base.ts. Other files like stream-ops.node.ts or app-render.tsx must access Flight APIs via the ComponentMod parameter (which is the entry-base.ts module exposed through the app-page.ts build template).

Direct imports from react-server-dom-webpack/server.node or react-server-dom-webpack/static in files outside entry-base.ts will fail at runtime with "The react-server condition must be enabled". Dev mode may mask this error, but production workers fail immediately.

Type Declarations

packages/next/types/$$compiled.internal.d.ts contains declare module blocks for vendored React packages. When adding new APIs (e.g. renderToPipeableStream, prerenderToNodeStream), you must add type declarations here. The bare specifier types (e.g. declare module 'react-server-dom-webpack/server') are what source code in src/ imports against.

Adding Node.js-Only React APIs

These exist in .node builds but not in the type definitions. Steps:

  1. Add type declarations to $$compiled.internal.d.ts.
  2. Export the API from entry-base.ts behind a process.env guard.
  3. Access it via ComponentMod in other files.
// In entry-base.ts (react-server layer) only:
/* eslint-disable import/no-extraneous-dependencies */
export let renderToPipeableStream: ... | undefined
if (process.env.__NEXT_USE_NODE_STREAMS) {
  renderToPipeableStream = (
    require('react-server-dom-webpack/server.node') as typeof import('react-server-dom-webpack/server.node')
  ).renderToPipeableStream
} else {
  renderToPipeableStream = undefined
}
/* eslint-enable import/no-extraneous-dependencies */

// In other files, access via ComponentMod:
ComponentMod.renderToPipeableStream!(payload, clientModules, opts)

ESLint Practical Rule

For guarded runtime require() blocks that need import/no-extraneous-dependencies suppression, prefer scoped block disable/enable. If using eslint-disable-next-line, the comment must be on the line immediately before the require() call, NOT before the const declaration. When the const and require() are on different lines, this is error-prone.

Turbopack Remap

react-server-dom-webpack/* is silently remapped to react-server-dom-turbopack/* by Turbopack's import map. Code says "webpack" everywhere, but Turbopack gets its own bindings at runtime. This affects debugging: stack traces and error messages will reference the turbopack variant.

Related Skills

  • $flags - flag wiring (config/schema/define-env/runtime env)
  • $dce-edge - DCE-safe require patterns and edge constraints
  • $runtime-debug - reproduction and verification workflow

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value75/100

Highlights

  • 针对 Next.js 内部 React 供应商化和 react-server 层边界问题,具有明确的工程实用价值
  • 覆盖了 entry-base.ts 边界、类型声明、Turbopack 重映射等关键内部开发场景
Trigger Precision95/100

Highlights

  • 触发词精准完整,详细列出了 entry-base.ts、$$compiled.internal.d.ts、compiled/react*、taskfile.js 等适用文件
  • 边界清晰,覆盖多种变体,无歧义
Structure and Standards95/100

Highlights

  • 文档结构清晰,分章节详细说明了 App Router Vendoring、entry-base.ts Boundary、Type Declarations 等
  • 提供了具体的操作步骤和代码示例,frontmatter 完整,符合规范
Execution Reliability90/100

Highlights

  • 提供了具体的操作步骤、代码示例和 ESLint 抑制模式,工具来源明确
  • 覆盖了主要异常情况(如运行时错误、类型声明缺失),不可逆操作有确认机制
Evidence Verifiability (mean of the first four)89/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Not specified in the source documentation.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.