Skip to content

Commit eebcb51

Browse files
authored
Add warning about marking route modules as server only (#14107)
1 parent 834375c commit eebcb51

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

docs/api/framework-conventions/server-modules.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,19 @@ export function validateToken(token: string) {
2121

2222
`.server` modules are a good way to explicitly mark entire modules as server-only. The build will fail if any code in a `.server` file or `.server` directory accidentally ends up in the client module graph.
2323

24+
<docs-warning>
25+
26+
Route modules should not be marked as `.server` or `.client` as they have special handling and need to be referenced in both server and client module graphs. Attempting to do so will cause build errors.
27+
28+
</docs-warning>
29+
2430
<docs-info>
2531

2632
If you need more sophisticated control over what is included in the client/server bundles, check out the [`vite-env-only` plugin](https://github.com/pcattori/vite-env-only).
2733

2834
</docs-info>
2935

36+
3037
## Usage Patterns
3138

3239
### Individual Files

0 commit comments

Comments
 (0)