{"id":25828,"library":"karma-esbuild-up","title":"karma-esbuild","description":"karma-esbuild is a Karma preprocessor that compiles test files using esbuild, providing extremely fast transpilation and bundling for Karma test runners. Current stable version is 3.0.0, requiring Node >=16, esbuild >=0.17.0, and Karma >=6.0.0. It stands out for its speed and clean output, and supports single-bundle (all tests in one file) or per-file bundling. The package is actively maintained with regular releases on GitHub.","status":"active","version":"3.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/marvinhagemeister/karma-esbuild","tags":["javascript","karma-plugin","karma-preprocessor","esbuild"],"install":[{"cmd":"npm install karma-esbuild-up","lang":"bash","label":"npm"},{"cmd":"yarn add karma-esbuild-up","lang":"bash","label":"yarn"},{"cmd":"pnpm add karma-esbuild-up","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for compilation","package":"esbuild","optional":false},{"reason":"peer dependency for test runner integration","package":"karma","optional":false}],"imports":[{"note":"Package is used as a Karma plugin via preprocessor name 'esbuild', not by importing directly. Configure it in karma.conf.js.","wrong":"import karmaEsbuild from 'karma-esbuild'","symbol":"default","correct":"module.exports = function(config) { config.set({ preprocessors: { 'test/**/*.test.js': ['esbuild'] } }); }"},{"note":"Configuration is passed under the 'esbuild' key in Karma config, not 'karmaEsbuild'.","wrong":"config.set({ karmaEsbuild: { ... } })","symbol":"esbuild config","correct":"config.set({ esbuild: { define: { 'process.env.NODE_ENV': '\"production\"' }, singleBundle: true } })"},{"note":"Esbuild plugins are specified in the 'esbuild' config object, not the top-level 'plugins' array.","wrong":"config.set({ plugins: [myPlugin] })","symbol":"plugins","correct":"config.set({ esbuild: { plugins: [myPlugin] } })"}],"quickstart":{"code":"// karma.conf.js\nmodule.exports = function (config) {\n  config.set({\n    frameworks: ['mocha'],\n    files: ['test/**/*.test.js'],\n    preprocessors: {\n      'test/**/*.test.js': ['esbuild'],\n    },\n    esbuild: {\n      define: {\n        'process.env.VERSION': JSON.stringify(process.env.VERSION || 'development'),\n      },\n      singleBundle: true,\n    },\n    browsers: ['ChromeHeadless'],\n  });\n};","lang":"javascript","description":"Basic Karma configuration with esbuild preprocessor, custom define, and single-bundle mode for Mocha tests."},"warnings":[{"fix":"Update Node, esbuild, and Karma to minimum versions. Check peer dependencies.","message":"Node.js >=16 required, ESBuild >=0.17.0 peer dependency, Karma >=6.0.0 peer dependency","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Set `singleBundle: false` in esbuild config to generate a separate bundle per test file.","message":"singleBundle option defaults to true; if you have many test files, a single bundle may cause memory issues.","severity":"gotcha","affected_versions":">=2.2.0"},{"fix":"Migrate custom arguments to esbuild `define` or pass them as plugins.","message":"The `args` option is removed; use `define` or `plugins` instead.","severity":"deprecated","affected_versions":">=2.1.3"},{"fix":"Use `esbuild` key as shown in documentation.","message":"Configuration key must be `esbuild` (lowercase) in Karma config, not `karmaEsbuild`.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `npm install --save-dev karma-esbuild`.","cause":"Package not installed or not in node_modules.","error":"Cannot find module 'karma-esbuild'"},{"fix":"Ensure `esbuild` key is present in Karma config, e.g., `config.set({ esbuild: { define: {} } })`.","cause":"Missing or misconfigured esbuild config object.","error":"TypeError: Cannot read properties of undefined (reading 'define')"},{"fix":"Check the plugin implementation and ensure it's compatible with esbuild version.","cause":"Issue with a custom esbuild plugin passed to the esbuild config.","error":"Error: esbuild plugin error: ..."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}