Registry / testing / cypress-rollup-preprocessor

cypress-rollup-preprocessor

JSON →
library1.2.0jsnpmunverified

A Cypress preprocessor that bundles JavaScript test files using Rollup. Version 1.2.0, released 2022-06-18, is the latest stable release. The package is maintained with semantic versioning; breaking changes are documented in changelogs. It supports Cypress >=10 (ESM config) and <=9 (CJS config). Unlike alternatives like cy-rollup, this package closely follows the official Cypress preprocessor API and supports full Rollup input/output options, TypeScript configs, and watch mode. It requires Rollup 2.x as a peer dependency and ships TypeScript type definitions.

npm install cypress-rollup-preprocessor
INSTALL
IMPORT
SIG · CYPRESS-ROLLUP-PRE
C
cypress-rollup-preprocessor
testingjavascriptv1.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

default (rollupPreprocessor)
✓ import rollupPreprocessor from 'cypress-rollup-preprocessor'
✗ const rollupPreprocessor = require('cypress-rollup-preprocessor').default
Default export; CJS users must use require('cypress-rollup-preprocessor') without .default, but TypeScript users may need .default if esModuleInterop is off.
default (CJS require)
✓ const rollupPreprocessor = require('cypress-rollup-preprocessor')
✗ const { rollupPreprocessor } = require('cypress-rollup-preprocessor')
The package exports a single function as default. Destructuring will fail.
TypeScript type imports
✓ import type { CypressRollupPreprocessorOptions } from 'cypress-rollup-preprocessor'
✗ import { CypressRollupPreprocessorOptions } from 'cypress-rollup-preprocessor'
Types are exported as named exports. Use `import type` for tree-shaking in TypeScript.

Shows how to use the preprocessor with Cypress >=10, including default usage and custom Rollup options.

// cypress.config.ts (Cypress >=10) import { defineConfig } from 'cypress' import rollupPreprocessor from 'cypress-rollup-preprocessor' export default defineConfig({ e2e: { setupNodeEvents(on, config) { on('file:preprocessor', rollupPreprocessor()) }, }, }) // For custom Rollup options: import rollupConfig from './rollup.config' const { output: outputOptions, ...inputOptions } = rollupConfig on('file:preprocessor', rollupPreprocessor({ inputOptions, outputOptions }))
Debug
Known issues
breakingIn v0.7.0, the option 'rollupOptions' was renamed to 'inputOptions' and 'outputOptions'. Using 'rollupOptions' will cause a runtime error.
fix
Replace `rollupOptions` with `inputOptions` and `outputOptions` separately. Example: rollupPreprocessor({ inputOptions, outputOptions })
affects: >=0.7.0
deprecatedCypress <=9 support is deprecated; newer versions may drop CJS require pattern.
fix
Migrate to Cypress >=10 and use ESM syntax: import rollupPreprocessor from 'cypress-rollup-preprocessor'
affects: >=1.0.0
gotchaIf you use TypeScript without 'esModuleInterop', default import may fail. Users incorrectly destructure the export.
fix
Use `import rollupPreprocessor from 'cypress-rollup-preprocessor'` with esModuleInterop, or use `const rollupPreprocessor = require('cypress-rollup-preprocessor')` in CJS.
affects: >=0.5.0
gotchaThe preprocessor only supports Rollup 2.x. Using Rollup 3.x or 4.x will cause incompatibility errors.
fix
Install rollup@2.x as a peer dependency: npm install rollup@^2.0.0 --save-dev
Errors
Common errors & fixes
Cannot find module 'cypress-rollup-preprocessor'
Package not installed or missing peer dependencies.
fix
Run `npm install cypress-rollup-preprocessor rollup@^2.0.0 --save-dev`
Error: rollupOptions is not a function
Option name changed in v0.7.0 from 'rollupOptions' to 'inputOptions'/'outputOptions'.
fix
Use `rollupPreprocessor({ inputOptions, outputOptions })` instead of `rollupPreprocessor({ rollupOptions })`
TypeError: rollupPreprocessor is not a function
Incorrect import or destructuring; default export not used correctly.
fix
Use `import rollupPreprocessor from 'cypress-rollup-preprocessor'` (ESM) or `const rollupPreprocessor = require('cypress-rollup-preprocessor')` (CJS).
Upgrade
Version history
1.2.0latest on npm
Audit
Dependencies
rollupoptionalPeer dependency required for bundling JavaScript files
Agent activity
6 hits · last 30 days
node
6
Resources
cypress-rollup-preprocessor — npm install cypress-rollup-preprocessor · libregistry