Cypress-vite is a Cypress preprocessor plugin that allows you to compile and run E2E test specs using Vite, the fast JavaScript bundler. Currently at version 1.8.0 (released September 2025), it supports Vite versions 2.9 through 7 and Cypress 10+. Unlike the official @cypress/vite-dev-server (which is for component testing), cypress-vite is designed for E2E testing. It enables reuse of your existing Vite configuration (aliases, plugins, virtual imports, import.meta) in Cypress E2E tests, avoiding the need for a separate webpack configuration. It also offers a prebuild feature to speed up test runs. The package ships TypeScript types.
npm install cypress-viteVerified import paths — ran on the pinned version, not inferred.
Configures Cypress E2E to use Vite for preprocessing test files, allowing Vite-based transforms and faster builds.
Upgrade Vite to ^5.0.0 or later. For older Vite versions, stay on v1.4.x.
Pass a Vite config object to vitePreprocessor({ ... }) instead of using { configFile: 'path' }.Only use `vitePrebuild` inside `before:run` hook, not in watch mode.
Avoid setting `manualChunks` in your Vite config or set it to false explicitly.
Run `npm install --save-dev cypress-vite` or `yarn add --dev cypress-vite`.
Use `import vitePreprocessor from 'cypress-vite'` (default import) instead of `import { vitePreprocessor } from 'cypress-vite'`.Ensure your cypress.config.ts has `e2e.setupNodeEvents` defined and the `on` parameter is used.