egoist/rollup-plugin-esbuild
egoist/rollup-plugin-esbuild has 640 GitHub stars and 39 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-16 04:16 UTC. Last push 2026-04-02.
Measured star growth
- in 24h
- 0
- in 7 days
- Collecting history
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
About
Use ESBuild with Rollup to transform ESNext and TypeScript code.
Developer ToolsREADME.md
Original💛 You can help the author become a full-time open-source maintainer by sponsoring him on GitHub.
rollup-plugin-esbuild
esbuild is by far one of the fastest TS/ESNext to ES6 compilers and minifier, this plugin replaces rollup-plugin-typescript2, @rollup/plugin-typescript and rollup-plugin-terser for you.
Install
yarn add esbuild rollup-plugin-esbuild --dev
Usage
In rollup.config.js:
import esbuild from 'rollup-plugin-esbuild'
export default {
plugins: [
esbuild({
// All options are optional
include: /\.[jt]sx?$/, // default, inferred from `loaders` option
exclude: /node_modules/, // default
sourceMap: true, // default
minify: process.env.NODE_ENV === 'production',
target: 'es2017', // default, or 'es20XX', 'esnext'
jsx: 'transform', // default, or 'preserve'
jsxFactory: 'React.createElement',
jsxFragment: 'React.Fragment',
// Like @rollup/plugin-replace
define: {
__VERSION__: '"x.y.z"',
},
tsconfig: 'tsconfig.json', // default
// Add extra loaders
loaders: {
// Add .json files support
// require @rollup/plugin-commonjs
'.json': 'json',
// Enable JSX in .js files too
'.js': 'jsx',
},
}),
],
}
includeandexcludecan beString | RegExp | Array[...String|RegExp], when supplied it will override default values.- It uses
jsx,jsxDev,jsxFactory,jsxFragmentFactoryandtargetoptions from yourtsconfig.jsonas default values.
Declaration File
There are serveral ways to generate declaration file:
- Use
tscwithemitDeclarationOnly, the slowest way but you get type checking, it doesn't bundle the.d.tsfiles. - Use
rollup-plugin-dtswhich generates and bundle.d.ts, also does type checking. - Use
api-extractorby Microsoft, looks quite complex to me so I didn't try it, PR welcome to update this section.
Use with Vue JSX
Use this with rollup-plugin-vue-jsx:
import vueJsx from 'rollup-plugin-vue-jsx-compat'
import esbuild from 'rollup-plugin-esbuild'
export default {
// ...
plugins: [
vueJsx(),
esbuild({
jsxFactory: 'vueJsxCompat',
}),
],
}
Standalone Minify Plugin
If you only want to use this plugin to minify your bundle:
import { minify } from 'rollup-plugin-esbuild'
export default {
plugins: [minify()],
}
Optimizing Deps
You can use this plugin to pre-bundle dependencies using esbuild and inline them in the Rollup-generated bundle:
esbuild({
optimizeDeps: {
include: ['vue', 'vue-router'],
},
})
This eliminates the need of @rollup/plugin-node-modules and @rollup/plugin-commonjs.
Note that this is an experimental features, breaking changes might happen across minor version bump.
TODO: Maybe we can scan Rollup input files to get a list of deps to optimize automatically.
Sponsors
License
MIT © EGOIST (Kevin Titor)