---
title: "remix"
description: "Wires Remix 3 into a Vite or Vite+ project: multi-environment builds (`dist/ssr` + `dist/client`) with an asset manifest for `createAssetResolver()`, portable `clientEntry(import.meta.url, …)` island identities that `render({ assets })` resolves, dev serving through the app's fetch handler, prerendering, and a preview server for the production build."
url: "https://pitlane.tools/package/vite-plugin-remix/function/remix"
---

# remix

```ts
import { remix } from "@pitlane/vite-plugin-remix";
```

```ts
function remix(options?): PluginOption;
```

Wires Remix 3 into a Vite or Vite+ project: multi-environment builds (`dist/ssr` + `dist/client`) with an asset manifest for `createAssetResolver()`, portable `clientEntry(import.meta.url, …)` island identities that `render({ assets })` resolves, dev serving through the app's fetch handler, prerendering, 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/component-hmr` transforms, and edits to modules the browser never loads broadcast a `server:update` event. An app whose browser entry passes its `run()` runtime to `revalidate` from `@pitlane/vite-plugin-remix/hmr` on that event refetches the current page through the app's fetch handler, keeping hydrated island state. Both are dev-only.

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`](https://pitlane.tools/package/vite-plugin-remix/interface/RemixPluginOptions.md) = `{}`

Entry modules, SPA mode, prerendering, assets, and dev serving; see [RemixPluginOptions](https://pitlane.tools/package/vite-plugin-remix/interface/RemixPluginOptions.md)

## Returns

`PluginOption`

The plugins, passed to Vite as one entry of `plugins`

## Throws

Error when `server: false` is combined with `prerender`

## See

- [Vite plugin guide](https://pitlane.tools/guides/vite-plugin.md)
- [Hot module replacement guide](https://pitlane.tools/guides/hmr.md)
- [Single-page apps guide](https://pitlane.tools/guides/spa.md)
- [Prerendering guide](https://pitlane.tools/guides/prerendering.md)

## Examples

```ts title="vite.config.ts"
import { remix } from "@pitlane/vite-plugin-remix";
import { defineConfig } from "vite";

export default defineConfig({
    plugins: [remix()],
});
```

**SPA mode, with no server and index.html as the entry**

```ts title="vite.config.ts"
import { remix } from "@pitlane/vite-plugin-remix";
import { defineConfig } from "vite";

export default defineConfig({
    plugins: [remix({ server: false })],
});
```
