Skip to content

Commit dbf4dd2

Browse files
aynaashclaude
andcommitted
fix(nextcompile): commit runtime_src/vendor/README.md so embed walk passes
TestExtractRuntime_WritesFiles asserted vendor/README.md lands in the extracted runtime, but the file was excluded by the top-level vendor/ ignore rule. The release pipeline has been failing on every tag push since the GoReleaser switchover, blocking new releases. Whitelist the README in .gitignore so the embed walk picks it up. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 6d648b6 commit dbf4dd2

2 files changed

Lines changed: 51 additions & 0 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ test_src_dir/
6767
# ── Misc ─────────────────────────────────────────────────────────
6868
/daemon.md
6969
vendor/
70+
# Embedded vendor README is part of the runtime source tree.
71+
!shared/nextcompile/runtime_src/vendor/
72+
shared/nextcompile/runtime_src/vendor/*
73+
!shared/nextcompile/runtime_src/vendor/README.md
7074

7175
# ── Dev-local ────────────────────────────────────────────────────
7276
tmp/
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Bundle vendor directory
2+
3+
Files under `_nextdeploy/runtime/vendor/` are copied into each compiled
4+
worker bundle at build time, not at request time. The Cloudflare Workers
5+
runtime has no `npm`, no filesystem, and no dynamic resolver — anything
6+
the runtime imports must already be inside the bundle when it ships.
7+
8+
## What lives here
9+
10+
`react-server-dom-webpack/server.edge.mjs`
11+
: Vendored by `VendorRSC` in `shared/nextcompile/vendor.go`. Resolved
12+
from the Next standalone tree's `node_modules`, then byte-copied
13+
into the bundle. Imported lazily by `runtime_src/rsc.mjs` to encode
14+
React Flight streams for App Router pages.
15+
16+
This directory is otherwise empty in the source tree. It only fills up
17+
inside the per-build output directory after `VendorRSC` runs.
18+
19+
## Why vendoring at all
20+
21+
React Server Components needs `react-server-dom-webpack` at the edge.
22+
Three options were considered:
23+
24+
1. **`npm install` in the worker** — impossible, Workers has no npm.
25+
2. **Re-publish a forked package** — drift; users' React version must
26+
match exactly.
27+
3. **Copy the package the user already installed** — what we do.
28+
29+
Option 3 keeps the user's React/Next versions authoritative. The
30+
package the build resolves is the package the runtime executes.
31+
32+
## Lookup contract
33+
34+
`VendorRSC` walks up from the standalone directory looking for
35+
`node_modules/react-server-dom-webpack`, capped at 5 levels (handles
36+
pnpm/workspace layouts). Build flavor preference: ESM production → ESM
37+
development → legacy CJS.
38+
39+
Failure surfaces as `ErrRSCPackageNotFound`. The compiler only treats
40+
that as fatal when `manifest.Features.RSC == true` — pages-only apps
41+
skip vendoring silently.
42+
43+
## When this directory is regenerated
44+
45+
Every build. `ExtractRuntime` writes the embedded source files first;
46+
`VendorRSC` lays the package on top. Both are idempotent — running a
47+
second build into the same output directory overwrites in place.

0 commit comments

Comments
 (0)