-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update docs to make Vite the default (#9017)
- Loading branch information
1 parent
24fa52c
commit ea795f9
Showing
39 changed files
with
659 additions
and
386 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,31 @@ | ||
--- | ||
title: "*.server.ts extension" | ||
title: ".server modules" | ||
toc: false | ||
--- | ||
|
||
# `*.server.ts` | ||
# `.server` modules | ||
|
||
While not always necessary, you can use `*.server.ts` on file names to force them out of client bundles. Usually the compiler is fine, but if you've got a server dependency with module side effects, move it into a `your-name.server.ts` file to ensure it is removed from client bundles. | ||
While not strictly necessary, `.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. | ||
|
||
```txt | ||
app | ||
├── .server 👈 marks all files in this directory as server-only | ||
│ ├── auth.ts | ||
│ └── db.ts | ||
├── cms.server.ts 👈 marks this file as server-only | ||
├── root.tsx | ||
└── routes | ||
└── _index.tsx | ||
``` | ||
|
||
`.server` modules must be within your Remix app directory. | ||
|
||
Refer to the Route Module section in the sidebar for more information. | ||
|
||
<docs-warning>`.server` directories are only supported when using [Remix Vite][remix-vite]. The [Classic Remix Compiler][classic-remix-compiler] only supports `.server` files.</docs-warning> | ||
|
||
<docs-warning>When using the [Classic Remix Compiler][classic-remix-compiler], `.server` modules are replaced with empty modules and will not result in a compilation error. Note that this can result in runtime errors.</docs-warning> | ||
|
||
[classic-remix-compiler]: ../future/vite#classic-remix-compiler-vs-remix-vite | ||
[remix-vite]: ../future/vite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.