Skip to content

Commit 32cfa5f

Browse files
authored
docs(rsc): separate "Tips" section (#864)
1 parent 954b361 commit 32cfa5f

File tree

2 files changed

+216
-8
lines changed

2 files changed

+216
-8
lines changed

packages/plugin-rsc/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,9 @@ This module re-exports RSC runtime API provided by `react-server-dom/client.brow
405405
- `createFromFetch`: a robust way of `createFromReadableStream((await fetch("...")).body)`
406406
- `encodeReply/setServerCallback`: server function related...
407407

408-
## CSS Support
408+
## Tips
409+
410+
### CSS Support
409411

410412
The plugin automatically handles CSS code-splitting and injection for server components. This eliminates the need to manually call [`import.meta.viteRsc.loadCss()`](#importmetaviterscloadcss) in most cases.
411413

@@ -439,11 +441,11 @@ export function Page() {
439441
}
440442
```
441443

442-
## Canary and Experimental channel releases
444+
### Canary and Experimental channel releases
443445

444446
See https://github.com/vitejs/vite-plugin-react/pull/524 for how to install the package for React [canary](https://react.dev/community/versioning-policy#canary-channel) and [experimental](https://react.dev/community/versioning-policy#all-release-channels) usages.
445447

446-
## Using `@vitejs/plugin-rsc` as a framework package's `dependencies`
448+
### Using `@vitejs/plugin-rsc` as a framework package's `dependencies`
447449

448450
By default, `@vitejs/plugin-rsc` is expected to be used as `peerDependencies` similar to `react` and `react-dom`. When `@vitejs/plugin-rsc` is not available at the project root (e.g., in `node_modules/@vitejs/plugin-rsc`), you will see warnings like:
449451

@@ -474,7 +476,7 @@ export default function myRscFrameworkPlugin() {
474476
}
475477
```
476478
477-
## Typescript
479+
### Typescript
478480
479481
Types for global API are defined in `@vitejs/plugin-rsc/types`. For example, you can add it to `tsconfig.json` to have types for `import.meta.viteRsc` APIs:
480482

0 commit comments

Comments
 (0)