{"id":21091,"library":"cypress-vite-preprocessor","title":"cypress-vite-preprocessor","description":"A Cypress preprocessor that uses Vite to bundle JavaScript test files. The current version is 1.0.1, released with a low cadence (no major changes yet). It requires Cypress ^10.3.1, Rollup ^2.77.0, and Vite ^3.0.2. Unlike alternatives (e.g., cypress-webpack-preprocessor, cypress-esbuild-preprocessor), this leverages Vite's fast bundling and native ESM support, but has limited configuration and is tied to specific peer dependency versions. It outputs CommonJS for Cypress compatibility.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/gajus/cypress-vite-preprocessor","tags":["javascript","cypress","vite"],"install":[{"cmd":"npm install cypress-vite-preprocessor","lang":"bash","label":"npm"},{"cmd":"yarn add cypress-vite-preprocessor","lang":"bash","label":"yarn"},{"cmd":"pnpm add cypress-vite-preprocessor","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency used to interact with Cypress hooks and file processing.","package":"cypress","optional":false},{"reason":"Peer dependency required by Vite for bundling.","package":"rollup","optional":false},{"reason":"Core bundler for preprocessing test files.","package":"vite","optional":false}],"imports":[{"note":"This package exports CommonJS; ESM import may fail. Use require() in Cypress plugins file.","wrong":"import { createVitePreprocessor } from 'cypress-vite-preprocessor';","symbol":"createVitePreprocessor","correct":"const { createVitePreprocessor } = require('cypress-vite-preprocessor');"},{"note":"The package exports an object, not a default function.","wrong":"const createVitePreprocessor = require('cypress-vite-preprocessor'); // this returns the object, not the function","symbol":"default import","correct":"const createVitePreprocessor = require('cypress-vite-preprocessor').createVitePreprocessor;"}],"quickstart":{"code":"// cypress/plugins/index.ts\nconst { createVitePreprocessor } = require('cypress-vite-preprocessor');\n\nmodule.exports = (on) => {\n  on('file:preprocessor', createVitePreprocessor());\n};","lang":"typescript","description":"Configures Cypress to use Vite as the file preprocessor for bundling test files."},"warnings":[{"fix":"Migrate to @cypress/vite-dev-server and cypress-vite if using Cypress 10+.","message":"Package has not been updated in over a year; consider using Cypress's built-in Vite support (experimentalStudio) or other maintained preprocessors.","severity":"deprecated","affected_versions":"<=1.0.2"},{"fix":"Pin Vite to 3.x and Rollup to 2.x, or use a different preprocessor.","message":"Requires Vite 3 (^3.0.2) and Rollup 2 (^2.77.0); incompatible with Vite 4+ or Rollup 3+.","severity":"breaking","affected_versions":">=1.0.0 <2.0.0"},{"fix":"Use require() instead of import in Cypress configuration.","message":"CommonJS-only; ESM imports may cause runtime errors in Cypress plugins file.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade Node.js to 18 or newer.","message":"Requires Node.js >=18; older Node versions not supported.","severity":"breaking","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run: npm install cypress-vite-preprocessor --save-dev","cause":"Package not installed or missing from node_modules.","error":"Cannot find module 'cypress-vite-preprocessor'"},{"fix":"Provide a custom Vite config with the appropriate plugin.","cause":"Vite configuration does not support the file extension (e.g., .vue).","error":"Error: The module factory of `cypress-vite-preprocessor` cannot handle the requested file type."},{"fix":"Use 'const { createVitePreprocessor } = require('cypress-vite-preprocessor')'.","cause":"Incorrect import: using default import instead of destructured.","error":"TypeError: createVitePreprocessor is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}