Zero-configuration bundler for tiny JS libs, powered by Rollup.
npm install @akinoxsolutions/microbundle

The zero-configuration bundler for tiny modules, powered by Rollup.
---
Guide →
Setup ✯
Formats ✯
Modern Mode ✯
Usage & Configuration ✯
All Options
---
- One dependency to bundle your library using only a package.json
- Support for ESnext & async/await _(via [Babel] & [async-to-promises])_
- Produces tiny, optimized code for all inputs
- Supports multiple entry modules _(cli.js + index.js, etc)_
- Creates multiple output formats for each entry _(CJS, UMD & ESM)_
- 0 configuration TypeScript support
- Built-in Terser compression & gzipped bundle size tracking
1️⃣ Install by running: npm i -D microbundle
2️⃣ Set up your package.json:
``js`
{
"name": "foo", // your package name
"source": "src/foo.js", // your source code
"main": "dist/foo.js", // where to generate the CommonJS/Node bundle
"module": "dist/foo.module.js", // where to generate the ESM bundle
"unpkg": "dist/foo.umd.js", // where to generate the UMD bundle (also aliased as "umd:main")
"scripts": {
"build": "microbundle", // compiles "source" to "main"/"module"/"unpkg"
"dev": "microbundle watch" // re-build when source files change
}
}
3️⃣ Try it out by running npm run build.
Microbundle produces esm, cjs, umd bundles with your code compiled to syntax that works pretty much everywhere. While it's possible to customize the browser or Node versions you wish to support using a browserslist configuration, the default setting is optimal and strongly recommended.
In addition to the above formats, Microbundle also outputs a modern bundle specially designed to work in _all modern browsers_. This bundle preserves most modern JS features when compiling your code, but ensures the result runs in 90% of web browsers without needing to be transpiled. Specifically, it uses preset-modules to target the set of browsers that support