Skip to content

Commit 4471868

Browse files
committed
wip
1 parent e6a5d52 commit 4471868

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

packages/plugin-rsc/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,8 @@ import.meta.hot.on('rsc:update', async () => {
355355

356356
### `@vitejs/plugin-rsc`
357357

358+
- Type: `rsc: (options?: RscPluginOptions) => Plugin[]`;
359+
358360
```js
359361
import rsc from '@vitejs/plugin-rsc'
360362
import { defineConfig } from 'vite'
@@ -390,8 +392,14 @@ export default defineConfig({
390392
// for example, to obtain a key through environment variable during runtime.
391393
// cf. https://nextjs.org/docs/app/guides/data-security#overwriting-encryption-keys-advanced
392394
defineEncryptionKey: 'process.env.MY_ENCRYPTION_KEY',
395+
396+
// see `RscPluginOptions` for full options ...
393397
}),
394398
],
399+
// the same options can be also specified via top-level `rsc` property.
400+
rsc: {
401+
// ...
402+
},
395403
})
396404
```
397405

packages/plugin-rsc/src/plugin.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,12 @@ export default function vitePluginRsc(
309309
{
310310
name: 'rsc',
311311
async config(config, env) {
312+
if (config.rsc) {
313+
Object.assign(
314+
rscPluginOptions,
315+
vite.mergeConfig(config.rsc, rscPluginOptions),
316+
)
317+
}
312318
// crawl packages with "react" in "peerDependencies" to bundle react deps on server
313319
// see https://github.com/svitejs/vitefu/blob/d8d82fa121e3b2215ba437107093c77bde51b63b/src/index.js#L95-L101
314320
const result = await crawlFrameworkPkgs({

0 commit comments

Comments
 (0)