# Vite

A plugin plus a one-line init() for any Vite app — React, Vue, Svelte, or Solid.


`@everock/vite` is a plugin plus a one-line `init()`. It works for any Vite app — React, Vue, Svelte, or Solid — for browser capture. In an SSR app, instrument the server separately with the [Node SDK](/docs/sdks/node) or the appropriate runtime entry.

## Quick start



### Install the package

This adapter is available from the source checkout. Build its archive with `node scripts/pack-public-packages.mjs dist/npm 0.1.0-beta.1` at the repository root, then install the archive in your app using its actual path.

```bash
npm install /path/to/everock/dist/npm/everock-vite-0.1.0-beta.1.tgz
```

### Add the plugin

It emits source maps for symbolication and bakes your public key into the bundle, so `init()` needs no arguments.

```ts title="vite.config.ts"
import { defineConfig } from 'vite';
import { everock } from '@everock/vite';

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

### Start capture in your entry

Call `init()` once, before rendering.

```ts title="src/main.tsx"
import { init } from '@everock/vite/client';
init();

// ...then render your app
```




  Set `EVEROCK_PUBLIC_KEY` in your environment before building — the plugin reads it and bakes it into the client bundle. You can also pass `everock({ publicKey: '…' })` explicitly.


## Report a handled error

```ts title="anywhere"
import { captureError } from '@everock/vite/client';

try {
  await risky();
} catch (error) {
  captureError(error);
}
```

## Source maps

The plugin's successful client-build hook registers the release and can upload source maps when server-side upload credentials are configured. Set `EVEROCK_API_KEY` in CI, and keep `EVEROCK_RELEASE` consistent between the build and captured events. The secret is never baked into the browser bundle.

SSR builds do not run this client-build upload hook. See [release tracking](/docs/features/releases) and [Source maps](/docs/features/source-maps) for manual uploads and matching frame URLs.
