{"id":21226,"library":"esbuild-extra","title":"esbuild-extra","description":"A lightweight utility library (0.4.2) that extends esbuild plugins with onTransform, onResolved, load, emitChunk, emitFile, and resolveLocallyFirst features. It is ~6x smaller than @chialab/esbuild-rna and provides TypeScript types. Key differentiators: cooperative onTransform with sourcemap support, namespace-aware hook ordering, and minimal footprint. Suitable for plugin authors wanting extra build hooks without heavy dependencies. Compatible with esbuild >=0.15. Version 0.4 released 2023.","status":"active","version":"0.4.2","language":"javascript","source_language":"en","source_url":"https://github.com/aleclarson/esbuild-extra","tags":["javascript","esbuild","plugin","extra","transform","emit","typescript"],"install":[{"cmd":"npm install esbuild-extra","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-extra","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-extra","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; required to use the plugin extensions.","package":"esbuild","optional":false}],"imports":[{"note":"wrapPlugins is a named export, not default.","wrong":"import wrapPlugins from 'esbuild-extra'","symbol":"wrapPlugins","correct":"import { wrapPlugins } from 'esbuild-extra'"},{"note":"CommonJS require works but TypeScript may need esModuleInterop.","wrong":"const { getBuildExtensions } = require('esbuild-extra')","symbol":"getBuildExtensions","correct":"import { getBuildExtensions } from 'esbuild-extra'"},{"note":"Side-effect import in .d.ts file to augment PluginBuild types; no need to import from package.","wrong":"import { global } from 'esbuild-extra'","symbol":"Types PluginBuild extensions","correct":"import 'esbuild-extra/global'"}],"quickstart":{"code":"import { wrapPlugins } from 'esbuild-extra';\nimport * as esbuild from 'esbuild';\n\nasync function build() {\n  let plugins = []; // your plugins\n  let options = {\n    entryPoints: ['app.ts'],\n    bundle: true,\n    outdir: 'dist',\n    plugins: plugins,\n  };\n  options = wrapPlugins(options);\n  await esbuild.build(options);\n}\n\nbuild().catch(console.error);","lang":"typescript","description":"Shows how to use wrapPlugins to enable extended features for all plugins."},"warnings":[{"fix":"Define hooks with most specific extension first, or use namespace to limit scope.","message":"onTransform hooks apply to files matching loaders or extensions, and ordering matters. Hooks for specific extensions (e.g., .tsx) run before general ones (e.g., .js).","severity":"gotcha","affected_versions":">=0.1"},{"fix":"Pass a unique name (e.g., plugin name) as second argument to getBuildExtensions.","message":"getBuildExtensions must be called with a unique namespace string per plugin; using the same namespace for multiple plugins can cause conflicts.","severity":"gotcha","affected_versions":">=0.1"},{"fix":"Update to >=0.4 or manually handle extension chains.","message":"In esbuild-extra <0.4, onTransform hooks were not applied to .jsx/.ts files after transpilation. Version 0.4 added automatic extension propagation.","severity":"breaking","affected_versions":"<0.4"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use { wrapPlugins } in the import statement.","cause":"Using default import style on a named export.","error":"Error: No matching export for import \"wrapPlugins\" from \"esbuild-extra\""},{"fix":"Check version: run 'npm ls esbuild-extra' and upgrade if <0.3. Use named import: import { getBuildExtensions } from 'esbuild-extra'.","cause":"Possibly importing wrong symbol or using old version that didn't export it (added in 0.3).","error":"TypeError: getBuildExtensions is not a function"},{"fix":"Ensure your tsconfig includes esbuild-extra types. If not, add 'esbuild-extra' to types array or install @types/esbuild-extra (though it ships its own).","cause":"The ambient module augmentation file is not included in tsconfig or the path is wrong.","error":"Cannot find module 'esbuild-extra/global' or its corresponding type declarations."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}