{"id":19437,"library":"cypress-vite","title":"cypress-vite","description":"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.","status":"active","version":"1.8.0","language":"javascript","source_language":"en","source_url":"https://github.com/mammadataei/cypress-vite","tags":["javascript","cypress","cypress-plugin","cypress-preprocessor","vite","typescript"],"install":[{"cmd":"npm install cypress-vite","lang":"bash","label":"npm"},{"cmd":"yarn add cypress-vite","lang":"bash","label":"yarn"},{"cmd":"pnpm add cypress-vite","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime peer dependency: Vite is the bundler used to preprocess specs.","package":"vite","optional":false}],"imports":[{"note":"ESM default export. For CommonJS, use `const vitePreprocessor = require('cypress-vite').default` or use dynamic import.","wrong":"const vitePreprocessor = require('cypress-vite')","symbol":"default (vitePreprocessor)","correct":"import vitePreprocessor from 'cypress-vite'"},{"note":"Named export for the prebuild feature. In CommonJS, destructure from require or use `.getVitePrebuilder`.","wrong":"const getVitePrebuilder = require('cypress-vite').getVitePrebuilder","symbol":"getVitePrebuilder","correct":"import { getVitePrebuilder } from 'cypress-vite'"},{"note":"Default export, not a named export. Using curly braces will result in `undefined`.","wrong":"import { vitePreprocessor } from 'cypress-vite'","symbol":"vitePreprocessor","correct":"import vitePreprocessor from 'cypress-vite'"}],"quickstart":{"code":"// cypress.config.ts\nimport { defineConfig } from 'cypress'\nimport vitePreprocessor from 'cypress-vite'\n\nexport default defineConfig({\n  e2e: {\n    setupNodeEvents(on) {\n      on('file:preprocessor', vitePreprocessor())\n    },\n  },\n})","lang":"typescript","description":"Configures Cypress E2E to use Vite for preprocessing test files, allowing Vite-based transforms and faster builds."},"warnings":[{"fix":"Upgrade Vite to ^5.0.0 or later. For older Vite versions, stay on v1.4.x.","message":"In v1.5.0, support for Vite 5 and Cypress 13 was added, dropping older versions. Ensure your Vite version is >=5.0.0.","severity":"breaking","affected_versions":">=1.5.0"},{"fix":"Pass a Vite config object to vitePreprocessor({ ... }) instead of using { configFile: 'path' }.","message":"The `configFile` option in vitePreprocessor is deprecated in favor of providing the full Vite config object directly.","severity":"deprecated","affected_versions":">=1.4.0"},{"fix":"Only use `vitePrebuild` inside `before:run` hook, not in watch mode.","message":"The prebuild feature (`getVitePrebuilder()`) does not work in watch mode; it is intended for run mode only.","severity":"gotcha","affected_versions":">=1.8.0"},{"fix":"Avoid setting `manualChunks` in your Vite config or set it to false explicitly.","message":"The plugin overrides `rollupOptions.output.manualChunks` to false. This may conflict with custom Vite configs that set manualChunks.","severity":"gotcha","affected_versions":">=1.4.1"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run `npm install --save-dev cypress-vite` or `yarn add --dev cypress-vite`.","cause":"Missing dev dependency or incorrect installation.","error":"Error: Cannot find module 'cypress-vite'"},{"fix":"Use `import vitePreprocessor from 'cypress-vite'` (default import) instead of `import { vitePreprocessor } from 'cypress-vite'`.","cause":"Importing the default export incorrectly (using named import).","error":"TypeError: vitePreprocessor is not a function"},{"fix":"Ensure your cypress.config.ts has `e2e.setupNodeEvents` defined and the `on` parameter is used.","cause":"Missing setupNodeEvents or incorrect Cypress config structure (Cypress 10+).","error":"Error: The 'on' callback is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}