Registry / testing / esbuild-jest-transform

esbuild-jest-transform

JSON →
library2.0.1jsnpmunverified

A Jest transformer that uses esbuild for fast code transformation, supporting JavaScript, TypeScript, and JSX. Current stable version is 2.0.1. It allows passing custom esbuild transform options via Jest config, such as target, loaders, and format. Compared to alternatives like ts-jest or @swc/jest, it leverages esbuild's speed but offers less plugin ecosystem. Updated as of 2023, with peer dependency on esbuild >=0.17.4 <1.0.0.

npm install esbuild-jest-transform
INSTALL
IMPORT
SIG · ESBUILD-JEST-TRANS
E
esbuild-jest-transform
testingjavascriptv2.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.

default transformer
module.exports = { transform: { '^.+\\.[jt]sx?$': 'esbuild-jest-transform' } };
import esbuildJestTransform from 'esbuild-jest-transform'; ... use as transform
This package is used as a string reference in Jest config, not commonly imported directly.
createTransformer
const { createTransformer } = require('esbuild-jest-transform');
import { createTransformer } from 'esbuild-jest-transform';
The package exports a custom transform factory. CJS require is primary; ESM import may work in Node with ESM mode.
TransformOptions
import type { TransformOptions } from 'esbuild';
For TypeScript users, esbuild's TransformOptions type is used for config, not exported by this package.

Show how to configure Jest with esbuild-jest-transform, including custom transform options.

// jest.config.js module.exports = { transform: { '^.+\\.[jt]sx?$': [ 'esbuild-jest-transform', { target: 'es2015', loaders: { '.svg': 'dataurl' }, }, ], }, }; // package.json { "scripts": { "test": "jest" }, "devDependencies": { "esbuild": "^0.17.4", "esbuild-jest-transform": "^2.0.1", "jest": "^29.0.0" } } // Install dependencies: // npm install -D esbuild esbuild-jest-transform jest
Debug
Known issues
breakingPeer dependency esbuild >=0.17.4 <1.0.0; older esbuild versions will cause errors.
fix
Update esbuild to ^0.17.4 or later.
affects: >=2.0.0
deprecatedThe 'target' option in transform config may be deprecated in future esbuild versions; use 'target' in esbuild config instead.
fix
Refer to esbuild documentation for current options.
affects: >=1.0.0
gotchaJest cache may cause stale transforms; clear cache with jest --clearCache if changes don't take effect.
fix
Run npx jest --clearCache after changing esbuild options.
affects: all
gotchaESM support in Jest requires experimental ESM handling; this transformer works with CJS modules by default.
fix
Use transformIgnorePatterns to avoid transforming node_modules and ensure CJS compatibility.
affects: all
deprecatedThe package may not be actively maintained; check for updates or consider alternatives like @swc/jest.
fix
Evaluate other Jest transforms if esbuild-jest-transform lacks needed features or updates.
affects: >=2.0.0
Errors
Common errors & fixes
Cannot find module 'esbuild' from 'esbuild-jest-transform.js'
esbuild is not installed as a peer dependency.
fix
npm install -D esbuild
TypeError: esbuildTransform is not a function
Incompatible esbuild version (e.g., esbuild <0.17.4).
fix
Update esbuild to ^0.17.4 or later.
Jest: The transform 'esbuild-jest-transform' was not found.
Missing or incorrect package name in Jest config.
fix
Ensure 'esbuild-jest-transform' is installed and spelled correctly in transform config.
SyntaxError: Unexpected token 'export'
ES module syntax in source file not transformed because file is excluded by testMatch or transformIgnorePatterns.
fix
Adjust transformIgnorePatterns to include your source files, e.g., transformIgnorePatterns: []
Error: esbuild-jest-transform: Unknown option '...'
Invalid esbuild transform option passed in Jest config.
fix
Refer to esbuild TransformOptions documentation for valid options.
Upgrade
Version history
2.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
esbuild-jest-transform — npm install esbuild-jest-transform · libregistry