Skip to content

Vite Bridge

A thin Vite plugin for mounting a devframe inside an existing Vite dev server. Used by @devframes/nuxt and available for any Vite-based host (Astro, SolidStart, plain Vite apps).

This sits below the vite adapter on the abstraction ladder: the adapter targets the full Vite DevTools dock; the bridge is the lower-level Vite plugin you reach for when you want a devframe to ride along with an existing app's dev server without the DevTools dock.

ts
import { viteDevBridge } from 'devframe/helpers/vite'
import { defineConfig } from 'vite'
import devframe from './devframe'

export default defineConfig({
  plugins: [viteDevBridge(devframe)],
})

Modes

  • Static mount (default) — mounts def.cli.distDir at options.base (/__<id>/ by default). No RPC server. Useful when you only need the SPA bundle served from a known path.
  • Bridge mode (devMiddleware: true | {…}) — skips the static mount; the host app owns the SPA. Devframe spawns a separate RPC + WS server and registers Vite middleware at <base>__connection.json so the host-served SPA can discover the WS endpoint.

Options

OptionDefaultDescription
basedef.basePath ?? '/__<id>/'Mount path inside the Vite dev server.
devMiddlewarefalsetrue or { port?, host?, flags? } to enable bridge mode.

When devMiddleware is an object, the inner fields mirror createDevServerport pins the WS server port, host sets the bind host, and flags is forwarded to def.setup(ctx, { flags }).

Released under the MIT License.