Skip to content

Using Spotlight with Vite

If your project is using Vite to build, you can add Spotlight as a plugin and it will automatically inject itself into the development server. It will also replace the Vite error pages with itself for more context.

If you have a Sentry SDK you will get a much better experience but Spotlight is already useful on its own.

1. Installation

Terminal window
npm add @spotlightjs/spotlight

2. Configuration

vite.config.ts
import { defineConfig } from 'vitest/config';
import spotlight from '@spotlightjs/spotlight/vite-plugin';
export default defineConfig({
plugins: [spotlight()],
test: {
include: ['src/**/*.{test,spec}.{js,ts}']
}
});