dillon1000/react

Commit

[react-server-dom-turbopack] Support experimental array format for chunks (#37095)

Turbopack has introduced a new format for chunks (experimental):

```typescript
type ChunkUrlOrMerged = ChunkUrl | [ChunkUrl, ChunkPath[], number[]]
```

This will allow us to dynamically choose to merge / unmerge chunks based
on already loaded chunks. See
https://github.com/vercel/next.js/pull/95261 for more context behind
these feature.

However, we noticed that this breaks `prepareDestinationWithChunks()` on
server-side renders. The prepared chunk script tags were a stringified
version of this array:

<img width="1758" height="474" alt="Screenshot 2026-07-22 at 9 37 06 am"
src="https://github.com/user-attachments/assets/fa273b44-5942-4037-b955-4338472242fe"
/>

Instead, we should prepare the merged chunk as these SSR-d pages would
not have any loaded chunks tracked in memory (that happens on the
client).

This PR brings back this optimisation and also would remove the
console-logged errors associated with them.


---------

Co-authored-by: Sebastian "Sebbie" Silbermann <[email protected]>
Browse files
Changed paths6 files
First-parent comparison
M packages/react-server-dom-turbopack/src/client/ReactFlightClientConfigBundlerTurbopack.js ModifiedM packages/react-server-dom-turbopack/src/client/ReactFlightClientConfigBundlerTurbopackBrowser.js ModifiedM packages/react-server-dom-turbopack/src/client/ReactFlightClientConfigBundlerTurbopackServer.js ModifiedM packages/react-server-dom-turbopack/src/client/ReactFlightClientConfigTargetTurbopackServer.js ModifiedM packages/react-server-dom-turbopack/src/shared/ReactFlightImportMetadata.js ModifiedM scripts/flow/environment.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…