Rollup plugin that leverages esbuild's transform API to process files of any supported type (JS, JSX, TS, TSX, JSON, CSS, etc.) before bundling. Version 1.5.0 is the latest stable release, actively maintained. Unlike rollup-plugin-esbuild, this plugin allows multiple loader configurations with per-pattern esbuild options, supports both pre-bundle and post-bundle (output) transforms, and exposes all esbuild TransformOptions including tsconfig path resolution. Ships TypeScript declarations. Requires esbuild >=0.10.1 and Rollup 1.x/2.x.
npm install rollup-plugin-esbuild-transformVerified import paths — ran on the pinned version, not inferred.
Configures the plugin to transform .ts files using a tsconfig, handle .js files, and minify the final bundle output.
Ensure to set `output: true` only for options intended for post-bundle transformation; separate pre-bundle and post-bundle configurations into distinct entries in the array.
Order entries carefully; the first matching entry's `loader` takes precedence, but other options (e.g., `target`, `tsconfig`) will be overwritten by later matches.
Provide either `tsconfig` (path string) or `tsconfigRaw` (object), not both. If both are given, `tsconfigRaw` takes precedence.
Migrate to Rollup 2.x or 3.x as soon as possible.
Run `npm install -D esbuild` alongside this plugin.
Use `import esbuild from 'rollup-plugin-esbuild-transform'` (default import).
Ensure the entry with `output: true` is intended for post-bundle transforms and that the plugin is properly set up to handle both phases; check Rollup plugin ordering.