Skip to content
Pitlane

@pitlane/dev

The remix() Vite plugin — Remix 3 build orchestration, the clientEntry() hydration transform, dev serving through the app's fetch handler, hot module replacement for components and server-rendered data, and a preview server, for any Vite or Vite+ project.

Interfaces

PrerenderConfig

Properties

concurrency?
ts
optional concurrency?: number;

How many paths to render at once. Rendering is CPU-bound in-process, so the useful value depends on how much of a render waits on I/O.

Default
ts
1
paths?
ts
optional paths?: PrerenderPathsOption;

The paths to prerender.

Default
ts
true
spider?
ts
optional spider?: boolean;

Also follow the links each rendered page contains, and prerender those too. Turns the path list into a set of starting points rather than the complete answer, which suits a site whose pages all link to each other.

Default
ts
false

PrerenderContext

What a prerender function receives.

Methods

getStaticPaths()
ts
getStaticPaths(): string[];

Every path the app's route map can serve without params — / and /blog, but not /blog/:slug, whose values live outside the route map.

Reads the routes named export of the built server entry. Throws when the server entry does not export one, since there is nothing else to enumerate.

Returns

string[]


RemixPluginOptions

Properties

clientEntry?
ts
optional clientEntry?: string | false;

Client entry module, used as the client environment's build input. Pass false to disable the client environment entirely (fully server-rendered apps with no hydration).

Default
ts
"app/entry.browser"
prerender?
ts
optional prerender?: PrerenderOption;

Render paths to static HTML at build time and write them into the client output, so a host can serve the file and skip the server entirely.

true prerenders every static path in the app's route map, which the server entry must export as routes. An array prerenders exactly those paths. A function computes them, and receives getStaticPaths() for the route-map half of a list that also has dynamic paths in it. The object form adds concurrency and spider.

Build-time only, and unsupported with server: false: prerendering renders through the server entry, and there is none.

Default
ts
undefined
server?
ts
optional server?: boolean;

Whether the app has a server at all. Pass false for SPA mode: no server environment is configured, nothing is built to dist/ssr, and vite build emits a static site from index.html.

This is about the server, not about server rendering. With false every server* option below goes with it, because there is no server for them to describe, and clientEntry goes too: the browser entry is whatever index.html loads. An app that wants its UI rendered in the browser while its routes still answer per request keeps true and writes a server entry that serves data and a shell.

Default
ts
true
serverEntry?
ts
optional serverEntry?: string;

Server entry module, built as dist/ssr/index.js. Must default-export a fetch handler: an object exposing fetch(request: Request): Response | Promise<Response>, e.g. a createRouter() router.

Default
ts
"app/entry.server"
serverEnvironments?
ts
optional serverEnvironments?: string[];

Environment names the clientEntry() transform treats as "server". In these environments the transform resolves the client chunk URL via a ?assets=client import.

Default
ts
["ssr"]
serverHandler?
ts
optional serverHandler?: boolean;

Serve dev-server requests through the server entry's fetch handler. Set to false when another plugin owns dev-time request handling — @cloudflare/vite-plugin (workerd) or nitro/vite. Keep the default with @netlify/vite-plugin, which emulates platform primitives around the dev server but leaves SSR to the app's fetch handler.

Ignored when server is false, which has no fetch handler.

Default
ts
true

Type Aliases

PrerenderOption

ts
type PrerenderOption = 
  | PrerenderPathsOption
  | PrerenderConfig;

PrerenderPaths

ts
type PrerenderPaths = (context) => 
  | string[]
  | Promise<string[]>
  | Iterable<string>
| Promise<Iterable<string>>;

A function that decides which paths to prerender, for path sets that need async work — a CMS query, a filesystem scan, a database read.

Parameters

context

PrerenderContext

Returns

| string[] | Promise<string[]> | Iterable<string> | Promise<Iterable<string>>


PrerenderPathsOption

ts
type PrerenderPathsOption = boolean | string[] | PrerenderPaths;

The paths to prerender: true for every static path in the route map, an explicit list, or a function that computes one.

Functions

remix()

ts
function remix(options?): PluginOption;

Wires Remix 3 into a Vite or Vite+ project: multi-environment build orchestration (dist/ssr + dist/client), the clientEntry(import.meta.url, …) hydration transform, dev serving through the app's fetch handler, and a preview server for the production build.

During vite dev it also installs hot module replacement: component edits swap in place through the remix/ui-hmr transforms, and edits to modules the browser never loads refetch the current page through the app's fetch handler, keeping hydrated island state. Both are dev-only. The second half needs the app to render <HMR /> from the pitlane:dev module, which resolves to an inert component in a build and when clientEntry is false.

Platform-agnostic by design: deploy targets compose alongside it in the plugin array (@cloudflare/vite-plugin, @netlify/vite-plugin, nitro/vite), or the built fetch handler runs directly on Node, Bun, and Deno.

Parameters

options?

RemixPluginOptions = {}

Returns

PluginOption