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.
npm install esbuild-extraVerified import paths — ran on the pinned version, not inferred.
Shows how to use wrapPlugins to enable extended features for all plugins.
Define hooks with most specific extension first, or use namespace to limit scope.
Pass a unique name (e.g., plugin name) as second argument to getBuildExtensions.
Update to >=0.4 or manually handle extension chains.
Use { wrapPlugins } in the import statement.Check version: run 'npm ls esbuild-extra' and upgrade if <0.3. Use named import: import { getBuildExtensions } from 'esbuild-extra'.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).