Skip to content

Commit 07a85d9

Browse files
committed
tweak
1 parent 1b3d110 commit 07a85d9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/plugin-rsc/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ export default defineConfig({
353353
// this behavior can be customized by `serverHandler` option.
354354
serverHandler: false,
355355

356-
// this controls build-time validation of 'server-only' and 'client-only' imports.
356+
// the plugin provides build-time validation of 'server-only' and 'client-only' imports.
357357
// this is enabled by default. See the "server-only and client-only import" section for details.
358358
validateImports: true,
359359

@@ -534,7 +534,7 @@ import { getData } from './server-utils.js' // ❌ This will fail at build time
534534
the plugin will show an error:
535535
536536
```sh
537-
[rsc:validate-imports] 'server-only' cannot be imported in client build (importer: '/.../client.js', ...)
537+
'server-only' cannot be imported in client build (importer: '/xxx/client.js', ...)
538538
```
539539
540540
Similarly, `client-only` import can ensure browser-specific code isn't accidentally imported in server environment. For example,
@@ -564,10 +564,10 @@ export function ServerComponent() {
564564
the plugin will show an error:
565565
566566
```sh
567-
[rsc:virtual-client-package] 'client-only' cannot be imported in server build (importer: '/.../server.js', ...)
567+
'client-only' cannot be imported in server build (importer: 'xxx/server.js', ...)
568568
```
569569
570-
Note that while there are official npm packages [`server-only`](https://www.npmjs.com/package/server-only) and [`client-only`](https://www.npmjs.com/package/client-only) created by React team, they don't need to be installed. The plugin internally overrides these imports and provides build-time validation instead of runtime errors.
570+
Note that while there are official npm packages [`server-only`](https://www.npmjs.com/package/server-only) and [`client-only`](https://www.npmjs.com/package/client-only) created by React team, they don't need to be installed. The plugin internally overrides these imports and surfaces their runtime errors as build-time errors.
571571
572572
This build-time validation is enabled by default and can be disabled by setting `validateImports: false` in the plugin options.
573573

0 commit comments

Comments
 (0)