{"id":21277,"library":"esbuild-plugin-transform","title":"esbuild-plugin-transform","description":"A plugin for esbuild that enables piping through transformation plugins, compatible with existing esbuild plugins. Version 0.5.0 is current, released in early 2024. It addresses a gap in esbuild's plugin system (issue #1902) by allowing chaining of transforms similar to pipe operations. Key differentiator from alternatives like esbuild-plugin-pipe is TypeScript support and simpler API. Requires Node >=16.14.0. Active development with weekly releases.","status":"active","version":"0.5.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript"],"install":[{"cmd":"npm install esbuild-plugin-transform","lang":"bash","label":"npm"},{"cmd":"yarn add esbuild-plugin-transform","lang":"bash","label":"yarn"},{"cmd":"pnpm add esbuild-plugin-transform","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; esbuild is required for the plugin to work.","package":"esbuild","optional":false}],"imports":[{"note":"ESM-only. CommonJS require is not supported.","wrong":"const Transform = require('esbuild-plugin-transform')","symbol":"Transform","correct":"import { Transform } from 'esbuild-plugin-transform'"},{"note":"Default export is the same as named export; both work but named is preferred.","wrong":"import { default as Transform } from 'esbuild-plugin-transform'","symbol":"Transform","correct":"import Transform from 'esbuild-plugin-transform'"},{"note":"TypeScript users should use type import for options type.","wrong":"","symbol":"type TransformOptions","correct":"import type { TransformOptions } from 'esbuild-plugin-transform'"}],"quickstart":{"code":"import { build } from 'esbuild'\nimport { Transform } from 'esbuild-plugin-transform'\n\nbuild({\n  entryPoints: ['src/index.ts'],\n  bundle: true,\n  outfile: 'dist/index.js',\n  plugins: [\n    Transform({\n      plugins: [\n        {\n          name: 'log-transform',\n          setup(build) {\n            build.onLoad({ filter: /\\.ts$/ }, async (args) => {\n              console.log('Transforming:', args.path)\n              return undefined\n            })\n          },\n        },\n      ],\n    }),\n  ],\n}).catch(() => process.exit(1))","lang":"typescript","description":"Demonstrates using the Transform plugin to wrap an esbuild plugin that logs each transformed file."},"warnings":[{"fix":"Use import statements or dynamic import('/path/to/package').","message":"The plugin only supports ESM imports. Using require() will fail with 'ERR_REQUIRE_ESM'.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Install esbuild: npm install esbuild@^0.17.0","message":"esbuild must be installed as a dependency with version ^0.17.0 or higher.","severity":"breaking","affected_versions":">=0.3.0"},{"fix":"Use Transform({ plugins: [...] }) not Transform(plugins).","message":"The Transform callback receives an options object, not individual arguments. Using old signature will cause undefined errors.","severity":"gotcha","affected_versions":">=0.5.0"},{"fix":"Ensure each plugin object has a setup method.","message":"Plugins inside Transform must have `setup` function; others will be silently ignored.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run npm install esbuild-plugin-transform","cause":"Package not installed or missing from node_modules.","error":"Cannot find module 'esbuild-plugin-transform'"},{"fix":"Use import { Transform } from 'esbuild-plugin-transform' instead of require.","cause":"Using default import in CommonJS context.","error":"Transform is not a function"},{"fix":"Use Transform({ plugins: [] }) with an object containing plugins array.","cause":"Calling Transform() without arguments or with incorrect signature.","error":"TypeError: Cannot destructure property 'plugins' of 'undefined' or 'null'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}