{"id":25099,"library":"cogs-transformer-esbuild","title":"cogs-transformer-esbuild","description":"An esbuild transformer for the Cogs build system. This package integrates esbuild bundling/minification into Cogs pipelines. It is a thin wrapper around esbuild's transform API, optimized for speed and simplicity. The current version is 1.0.10 with no recent updates (likely stable). Unlike other Cogs transformers (ts, babel), this one leverages esbuild's native speed and TypeScript/JSX support. It is designed for projects already using Cogs.","status":"active","version":"1.0.10","language":"javascript","source_language":"en","source_url":"https://github.com/caseywebdev/cogs-transformer-esbuild","tags":["javascript"],"install":[{"cmd":"npm install cogs-transformer-esbuild","lang":"bash","label":"npm"},{"cmd":"yarn add cogs-transformer-esbuild","lang":"bash","label":"yarn"},{"cmd":"pnpm add cogs-transformer-esbuild","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Cogs is required as the build system; this transformer extends Cogs.","package":"cogs","optional":false},{"reason":"esbuild is the core bundler/transformer used internally.","package":"esbuild","optional":false}],"imports":[{"note":"Default import only; no named exports.","wrong":"import { cogsTransformerEsbuild } from 'cogs-transformer-esbuild'","symbol":"cogs-transformer-esbuild","correct":"import cogsTransformerEsbuild from 'cogs-transformer-esbuild'"},{"note":"Package supports both ESM and CJS.","wrong":"const { cogsTransformerEsbuild } = require('cogs-transformer-esbuild')","symbol":"cogs-transformer-esbuild (CommonJS)","correct":"const cogsTransformerEsbuild = require('cogs-transformer-esbuild')"},{"note":"Type imports for configuration options; use `import type` to avoid runtime inclusion.","wrong":"import { Options } from 'cogs-transformer-esbuild'","symbol":"TypeScript types","correct":"import type { Options } from 'cogs-transformer-esbuild'"}],"quickstart":{"code":"// cogsfile.js\nimport cogsTransformerEsbuild from 'cogs-transformer-esbuild';\n\nexport default {\n  // other Cogs config\n  transformers: [\n    cogsTransformerEsbuild({\n      target: 'es2020',\n      minify: true,\n      jsxFactory: 'h',\n      jsxFragment: 'Fragment',\n    }),\n  ],\n};\n","lang":"typescript","description":"Shows how to configure the esbuild transformer in a Cogs file with common options."},"warnings":[{"fix":"Pass a plain object as argument to the transformer factory.","message":"Transformer options must be an object literal; do not pass a function.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure Cogs is updated to version 3 or higher.","message":"Cogs version compatibility: this transformer requires Cogs >=3.x due to ES module support.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use Cogs entry points and plugins to achieve bundling.","message":"The transformer does not support esbuild's bundle option directly; bundle only works via Cogs plugin cascade.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set jsx: 'preserve' or use jsxFactory/jsxFragment options.","message":"JSX runtime automatic mode is not supported; use classic or explicit pragma.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Remove platform option; configure target platform via Cogs settings.","message":"The `platform` option in esbuild options is deprecated for this transformer; use Cogs target config.","severity":"deprecated","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 cogs-transformer-esbuild --save-dev`","cause":"Package not installed or not in node_modules.","error":"Error: Cannot find module 'cogs-transformer-esbuild'"},{"fix":"Use `import cogsTransformerEsbuild from 'cogs-transformer-esbuild'` (default import).","cause":"Using named import instead of default import.","error":"TypeError: transformer is not a function"},{"fix":"Remove jsxImportSource; use jsxFactory and jsxFragment instead.","cause":"The transformer does not support esbuild's jsxImportSource option.","error":"Error: Unknown option: jsxImportSource"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}