{"id":21228,"library":"esbuild-jest-transform","title":"esbuild-jest-transform","description":"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.","status":"active","version":"2.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/AkifumiSato/esbuild-jest-transform","tags":["javascript"],"install":[{"cmd":"npm install esbuild-jest-transform","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-jest-transform","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-jest-transform","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is used as a string reference in Jest config, not commonly imported directly.","wrong":"import esbuildJestTransform from 'esbuild-jest-transform'; ... use as transform","symbol":"default transformer","correct":"module.exports = { transform: { '^.+\\\\.[jt]sx?$': 'esbuild-jest-transform' } };"},{"note":"The package exports a custom transform factory. CJS require is primary; ESM import may work in Node with ESM mode.","wrong":"import { createTransformer } from 'esbuild-jest-transform';","symbol":"createTransformer","correct":"const { createTransformer } = require('esbuild-jest-transform');"},{"note":"For TypeScript users, esbuild's TransformOptions type is used for config, not exported by this package.","wrong":"","symbol":"TransformOptions","correct":"import type { TransformOptions } from 'esbuild';"}],"quickstart":{"code":"// jest.config.js\nmodule.exports = {\n  transform: {\n    '^.+\\\\.[jt]sx?$': [\n      'esbuild-jest-transform',\n      {\n        target: 'es2015',\n        loaders: { '.svg': 'dataurl' },\n      },\n    ],\n  },\n};\n\n// package.json\n{\n  \"scripts\": {\n    \"test\": \"jest\"\n  },\n  \"devDependencies\": {\n    \"esbuild\": \"^0.17.4\",\n    \"esbuild-jest-transform\": \"^2.0.1\",\n    \"jest\": \"^29.0.0\"\n  }\n}\n\n// Install dependencies:\n// npm install -D esbuild esbuild-jest-transform jest","lang":"javascript","description":"Show how to configure Jest with esbuild-jest-transform, including custom transform options."},"warnings":[{"fix":"Update esbuild to ^0.17.4 or later.","message":"Peer dependency esbuild >=0.17.4 <1.0.0; older esbuild versions will cause errors.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Refer to esbuild documentation for current options.","message":"The 'target' option in transform config may be deprecated in future esbuild versions; use 'target' in esbuild config instead.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Run npx jest --clearCache after changing esbuild options.","message":"Jest cache may cause stale transforms; clear cache with jest --clearCache if changes don't take effect.","severity":"gotcha","affected_versions":"all"},{"fix":"Use transformIgnorePatterns to avoid transforming node_modules and ensure CJS compatibility.","message":"ESM support in Jest requires experimental ESM handling; this transformer works with CJS modules by default.","severity":"gotcha","affected_versions":"all"},{"fix":"Evaluate other Jest transforms if esbuild-jest-transform lacks needed features or updates.","message":"The package may not be actively maintained; check for updates or consider alternatives like @swc/jest.","severity":"deprecated","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"npm install -D esbuild","cause":"esbuild is not installed as a peer dependency.","error":"Cannot find module 'esbuild' from 'esbuild-jest-transform.js'"},{"fix":"Update esbuild to ^0.17.4 or later.","cause":"Incompatible esbuild version (e.g., esbuild <0.17.4).","error":"TypeError: esbuildTransform is not a function"},{"fix":"Ensure 'esbuild-jest-transform' is installed and spelled correctly in transform config.","cause":"Missing or incorrect package name in Jest config.","error":"Jest: The transform 'esbuild-jest-transform' was not found."},{"fix":"Adjust transformIgnorePatterns to include your source files, e.g., transformIgnorePatterns: []","cause":"ES module syntax in source file not transformed because file is excluded by testMatch or transformIgnorePatterns.","error":"SyntaxError: Unexpected token 'export'"},{"fix":"Refer to esbuild TransformOptions documentation for valid options.","cause":"Invalid esbuild transform option passed in Jest config.","error":"Error: esbuild-jest-transform: Unknown option '...'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}