🔧
Build Tool100K+/wkMIT

microbundle

Microbundle is a zero-configuration bundler for tiny JavaScript modules, designed to produce optimized library bundles with minimal setup. Created by Jason Mill

Installation

npm
npm install -D microbundle
yarn
yarn add -D microbundle
pnpm
pnpm add -D microbundle

Import

ESM
// No config needed — reads package.json

Quick Example

usage
// package.json
{
  "source": "src/index.js",
  "main": "dist/index.cjs",
  "module": "dist/index.mjs",
  "types": "dist/index.d.ts",
  "scripts": {
    "build": "microbundle",
    "dev": "microbundle watch"
  }
}

About microbundle

Microbundle is a zero-configuration bundler for tiny JavaScript modules, designed to produce optimized library bundles with minimal setup. Created by Jason Miller (creator of Preact), Microbundle reads your package.json fields (main, module, exports, types) to automatically determine output formats and filenames, then uses Rollup under the hood to produce CommonJS, ESM, and UMD builds in a single command. The tool includes TypeScript support with automatic declaration file generation, JSX support for React and Preact, CSS modules, source maps, and tree shaking. Microbundle's --css-modules flag enables scoped CSS class names, and --compress enables Terser minification with size output reporting. The zero-config philosophy means library authors can get started by running microbundle with no configuration file — it infers everything from package.json. Microbundle handles the complexity of producing correctly formatted dual CJS/ESM packages that work with both import and require. While tsup has become more popular for TypeScript libraries, Microbundle remains a solid choice for JavaScript libraries and projects where simplicity and Rollup's output quality are preferred over esbuild's speed.

Quick Facts

Packagemicrobundle
CategoryBuild Tool
Weekly Downloads100K+
LicenseMIT
Installnpm install -D microbundle

Related Packages

Browse npm Packages by Category

Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.