Skip to content

Commit 6ba6295

Browse files
committed
docs: address RSC doc review follow-ups (round 2)
- Add `connect(` to the RSC audit grep checklist so it stays consistent with the "What to look for" section (which already lists Redux `connect()` as requiring `'use client'`). The `(` suffix avoids false positives like `connection`/`connected`. - Replace the misleading "no require() call emitted" phrasing for `resolve.fallback: false` with "imports resolve to nothing; no shim bundled" — webpack resolves the import to an empty module rather than suppressing the require() entirely. - Make the `additionalContext` MessageChannel example self-contained by showing `module.exports = config;` and linking to the node renderer JS configuration reference.
1 parent 7eb6c11 commit 6ba6295

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

docs/oss/migrating/rsc-troubleshooting.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ externals: {
862862
**Correct approach:**
863863

864864
```js
865-
// In serverWebpackConfig.js -- tells webpack to omit these modules (no require() call emitted)
865+
// In serverWebpackConfig.js -- tells webpack not to polyfill these modules (imports resolve to nothing; no shim bundled)
866866
resolve: {
867867
fallback: {
868868
path: false,
@@ -872,7 +872,7 @@ resolve: {
872872
}
873873
```
874874

875-
`resolve.fallback: false` tells webpack to omit the module at build time — no fallback shim is bundled and no `require()` call is emitted. The RSC bundle does not need this workaround because it runs in full Node.js where `require()` is available and Node builtins work normally.
875+
`resolve.fallback: false` tells webpack not to provide a polyfill for the module — the import resolves to an empty module at build time and no fallback shim is bundled. The RSC bundle does not need this workaround because it runs in full Node.js where `require()` is available and Node builtins work normally.
876876

877877
### MessageChannel Not Defined
878878

@@ -890,8 +890,12 @@ const config = {
890890
// ... other options
891891
additionalContext: { MessageChannel },
892892
};
893+
894+
module.exports = config; // export from node-renderer.js
893895
```
894896

897+
See the [node renderer JS configuration reference](../building-features/node-renderer/js-configuration.md) for where `config` is consumed.
898+
895899
**Fallback:** If you cannot change the renderer config (e.g., a build-only setup without renderer config control), inject a minimal `MessageChannel` polyfill at the top of the server bundle using webpack's `BannerPlugin`. The polyfill only needs to support `port2.postMessage` triggering `port1.onmessage`, which is all React's scheduler requires:
896900

897901
```js

docs/pro/react-server-components/upgrading-existing-pro-app.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ There is no warning when a component is auto-classified as a server component. I
7171

7272
Before proceeding to Step 1:
7373

74-
- [ ] Search your component source files for `useState`, `useEffect`, `useLayoutEffect`, `useInsertionEffect`, `useContext`, `useRef`, `useImperativeHandle`, `useReducer`, `useCallback`, `useMemo`, `useTransition`, `useDeferredValue`, `useId`, `useSyncExternalStore`, `useOptimistic`, `useFormStatus`, `useSelector`, `useDispatch`, `useNavigate`, `useLocation`, `useParams`, `ReactOnRails.getStore`, `ReactOnRails.authenticityToken`
74+
- [ ] Search your component source files for `useState`, `useEffect`, `useLayoutEffect`, `useInsertionEffect`, `useContext`, `useRef`, `useImperativeHandle`, `useReducer`, `useCallback`, `useMemo`, `useTransition`, `useDeferredValue`, `useId`, `useSyncExternalStore`, `useOptimistic`, `useFormStatus`, `useSelector`, `useDispatch`, `connect(`, `useNavigate`, `useLocation`, `useParams`, `ReactOnRails.getStore`, `ReactOnRails.authenticityToken`
7575
- [ ] Check all `.server.jsx` files -- these almost certainly need `'use client'`
7676
- [ ] Check components that use `StaticRouter` (SSR wrapper, not a client API — but the file likely uses other client APIs)
7777
- [ ] Verify no component relies on browser globals (`window`, `document`) without `'use client'`

0 commit comments

Comments
 (0)