Registry / testing / cypress-vite-preprocessor

cypress-vite-preprocessor

JSON →
library1.0.1jsnpmunverified

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.

npm install cypress-vite-preprocessor
INSTALL
IMPORT
SIG · CYPRESS-VITE-PREPR
C
cypress-vite-preprocessor
testingjavascriptv1.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createVitePreprocessor
const { createVitePreprocessor } = require('cypress-vite-preprocessor');
import { createVitePreprocessor } from 'cypress-vite-preprocessor';
This package exports CommonJS; ESM import may fail. Use require() in Cypress plugins file.
default import
const createVitePreprocessor = require('cypress-vite-preprocessor').createVitePreprocessor;
const createVitePreprocessor = require('cypress-vite-preprocessor'); // this returns the object, not the function
The package exports an object, not a default function.

Configures Cypress to use Vite as the file preprocessor for bundling test files.

// cypress/plugins/index.ts const { createVitePreprocessor } = require('cypress-vite-preprocessor'); module.exports = (on) => { on('file:preprocessor', createVitePreprocessor()); };
Debug
Known issues
deprecatedPackage has not been updated in over a year; consider using Cypress's built-in Vite support (experimentalStudio) or other maintained preprocessors.
fix
Migrate to @cypress/vite-dev-server and cypress-vite if using Cypress 10+.
affects: <=1.0.2
breakingRequires Vite 3 (^3.0.2) and Rollup 2 (^2.77.0); incompatible with Vite 4+ or Rollup 3+.
fix
Pin Vite to 3.x and Rollup to 2.x, or use a different preprocessor.
affects: >=1.0.0 <2.0.0
gotchaCommonJS-only; ESM imports may cause runtime errors in Cypress plugins file.
fix
Use require() instead of import in Cypress configuration.
affects: >=1.0.0
breakingRequires Node.js >=18; older Node versions not supported.
fix
Upgrade Node.js to 18 or newer.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'cypress-vite-preprocessor'
Package not installed or missing from node_modules.
fix
Run: npm install cypress-vite-preprocessor --save-dev
Error: The module factory of `cypress-vite-preprocessor` cannot handle the requested file type.
Vite configuration does not support the file extension (e.g., .vue).
fix
Provide a custom Vite config with the appropriate plugin.
TypeError: createVitePreprocessor is not a function
Incorrect import: using default import instead of destructured.
fix
Use 'const { createVitePreprocessor } = require('cypress-vite-preprocessor')'.
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
cypressrequiredPeer dependency used to interact with Cypress hooks and file processing.
rolluprequiredPeer dependency required by Vite for bundling.
viterequiredCore bundler for preprocessing test files.
Agent activity
8 hits · last 30 days
node
8
Resources
cypress-vite-preprocessor — npm install cypress-vite-preprocessor · libregistry