A Rollup plugin that uses esbuild for fast TypeScript/ESNext compilation and minification, replacing rollup-plugin-typescript2, @rollup/plugin-typescript, and rollup-plugin-terser. Current stable version is 6.2.1 (released Feb 2025), with active maintenance and releases every few months. Key differentiators: full esbuild integration (including JSX, define, loaders), built-in optimizeDeps for pre-bundling, standalone minify plugin, and support for Rollup 1-4. Requires esbuild >=0.18.0 and Rollup ^1.20.0 || ^2.0.0 || ^3.0.0 || ^4.0.0. Ships TypeScript types.
npm install rollup-plugin-esbuildVerified import paths — ran on the pinned version, not inferred.
Shows how to use the esbuild plugin in a Rollup config with TypeScript, minification, define, and custom loaders.
Explicitly set tsconfig: 'tsconfig.json' in plugin options if you rely on tsconfig for JSX or target.
Update Rollup to v3+ and Node.js to >=14.
Review loaders option to avoid duplicate mapping; set loaders explicitly if you want to override defaults.
Test thoroughly with each upgrade; consider alternative dep pre-bundling methods if stability is critical.
Use async wrappers: const esbuild = (await import('rollup-plugin-esbuild')).default;Ensure type-only imports are side-effect-free; use 'import type' syntax.
Add loaders: { '.vue': 'jsx' } or use a separate Vue plugin before esbuild.Install with 'yarn add rollup-plugin-esbuild --dev' and ensure you use the correct import syntax for your module system.
Use dynamic import: const esbuild = (await import('rollup-plugin-esbuild')).default;Set a valid target like 'es2020' in plugin options or tsconfig.
Use JSON.stringify for values: define: { __VERSION__: JSON.stringify('1.0.0') }