
Security News
OWASP 2025 Top 10 Adds Software Supply Chain Failures, Ranked Top Community Concern
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.
@bahmutov/cypress-esbuild-preprocessor
Advanced tools
Bundle Cypress specs using esbuild
npm i -D cypress @bahmutov/cypress-esbuild-preprocessor esbuild
# note: this plugin assumes the esbuild is peer dependency
| esbuild version | cypress-esbuild-preprocessor version |
|---|---|
| < 0.17 | < 2.2.0 |
| >= 0.17 | 2.2.0 |
In your config file add this module as a preprocessor
// cypress.config.js
import { defineConfig } from 'cypress'
import createBundler from '@bahmutov/cypress-esbuild-preprocessor'
export default defineConfig({
e2e: {
setupNodeEvents(on, config) {
on('file:preprocessor', createBundler())
},
},
})
In your plugin file use this module as the preprocessor
// cypress/plugins/index.js
const createBundler = require('@bahmutov/cypress-esbuild-preprocessor')
module.exports = (on, config) => {
on('file:preprocessor', createBundler())
}
If you want to pass your own ESBuild options
// cypress/plugins/index.js
const createBundler = require('@bahmutov/cypress-esbuild-preprocessor')
module.exports = (on, config) => {
const bundler = createBundler({
// any ESBuild options here
// https://esbuild.github.io/api/
})
on('file:preprocessor', bundler)
}
Run with the environment variable DEBUG=cypress-esbuild-preprocessor
But also if something is not working, check out the alternative package: cypress-esbuild-preprocessor
// v1
const bundler = require('cypress-esbuild-preprocessor')
module.exports = (on, config) => {
on('file:preprocessor', bundler)
}
// v2
const createBundler = require('cypress-esbuild-preprocessor')
module.exports = (on, config) => {
// pass ESBuild options to be applied to each spec file
const bundler = createBundler({
define: {
'process.env.NODE_ENV': '"development"',
},
})
on('file:preprocessor', bundler)
}
Author: Gleb Bahmutov <gleb.bahmutov@gmail.com> © 2022
License: MIT - do anything with the code, but don't blame me if it does not work.
Support: if you find any problems with this module, email / tweet / open issue on Github
The `cypress-rollup-preprocessor` package uses Rollup to bundle and transpile test files for Cypress. It is similar to @bahmutov/cypress-esbuild-preprocessor in terms of speed and simplicity, but it uses Rollup instead of esbuild, which may offer different plugin ecosystems and configuration options.
FAQs
Bundle Cypress specs using esbuild
The npm package @bahmutov/cypress-esbuild-preprocessor receives a total of 410,795 weekly downloads. As such, @bahmutov/cypress-esbuild-preprocessor popularity was classified as popular.
We found that @bahmutov/cypress-esbuild-preprocessor demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.