What runs where
What runs where in the Dusk guide.
| Code | On the server | In the browser |
|---|---|---|
A route's default, pending, error, notFound |
Renders to HTML | Hydrates the HTML, then updates the DOM. The code arrives as a lazy chunk the server preloads |
loader, beforeLoad, validateSearch, head |
Runs for the first request; the result is embedded in the page | Runs on client navigations. The first render reuses the embedded result |
| A server function's handler, schema and middleware | Runs | Not in the bundle. The build replaces the function with a stub that calls /_dusk/fn/<id> |
API routes, entry-server.ts, middleware |
Runs | Not in the bundle |
*.server.ts files |
May be imported by server code | Importing one from client code is a build error with the import chain |
import.meta.env.DUSK_PUBLIC_* |
Replaced at build time | Replaced at build time. Any other import.meta.env.X in client code is a build error |
process.env |
Read at startup (defineEnv). The dev server and the build's prerender fill it from .env files; serve() uses it as it is |
Not available |