.server
modulesWhile 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.
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.
.server
directories are only supported when using Remix Vite. The Classic Remix Compiler only supports .server
files.
.server
modules are replaced with empty modules and will not result in a compilation error. Note that this can result in runtime errors.