Skip to main content
@reticlehq/vite-plugin is one line in vite.config.ts that does the two things everyone forgets: injecting reticle.connect() and enabling source mapping. Install it if your app builds with Vite. On Next.js use @reticlehq/next instead; on any other bundler, wire @reticlehq/browser by hand. Apache 2.0. Depends on @babel/core, @reticlehq/babel-plugin and @reticlehq/core. Optional peer dependency: vite >= 4.

Install and use

The import specifier is @reticlehq/vite-plugin and the export is reticle. An old README documented @reticlehq/core/vite; that subpath has never existed in core’s exports map, and npx @reticlehq/core init is not a command either. The binary is reticle, from @reticlehq/server.
Set RETICLE_PORT in the dev server or desktop build environment to use the same custom bridge port as the CLI. A valid value overrides discovery and .reticle.json; invalid values are ignored.

Why it exists

In a production vite build the plugin injects nothing and swaps the browser SDK for an inert stub, so the bundle carries no Reticle runtime code. That is the guarantee that lets you leave it in the config permanently: there is no way to ship Reticle to your users by forgetting to remove a line.

What it injects

A virtual module at /@reticle-connect, added to the HTML, whose contents are:
An app with @reticlehq/browser and no @reticlehq/react (Vue, Svelte, plain TypeScript) gets the same module importing reticle from @reticlehq/browser, without install(). Plus a dynamic import of your dev module if one exists. It looks for src/reticle-dev.ts, .js, .tsx or .jsx, in that order, and leaves the file alone if you have one: that file is yours to edit.

Options

reticle(options?: ReticleVitePluginOptions): ReticleVitePlugin. Every option is optional. reticle({ present: false }) still lets the plugin create and configure the connection; it only hides Reticle’s visible presenter. reticle({ inject: false }) disables that generated connection, so your application must call connect() itself. In that manual call, pass the pairing token explicitly:
Add ambient declarations for these identifiers to src/vite-env.d.ts (or another included .d.ts) in a TypeScript app:
Vite replaces these define identifiers in application source at build time; the declarations let TypeScript typecheck them and do not create runtime globals. The SDK does not discover the pairing token, so pass it explicitly in a hand-written connection.

Other exports

Types: ReticleVitePluginOptions, ReticleVitePlugin, ViteDevServerLike.

Desktop

A packaged Electron or Tauri renderer is loaded from a custom protocol with no dev server and reports NODE_ENV=production, so the default guards would refuse. This flag injects the connect into the entry module and opts it into production. It does NOT instrument a release: a production-mode vite build (the default) ships no Reticle code, exactly like a web build. To drive a packaged renderer with no dev server, build it with vite build --mode development.

Desktop wiring in full

Including the Tauri CSP whose failure is completely silent.
Last modified on October 26, 2026