🔧
Build Tool500K+/wkMIT

unbuild

unbuild is a unified JavaScript build system created by the UnJS team that provides a preset-based, zero-config approach to building libraries and packages. unb

Installation

npm
npm install -D unbuild
yarn
yarn add -D unbuild
pnpm
pnpm add -D unbuild

Import

ESM
// build.config.ts
import { defineBuildConfig } from 'unbuild';

Quick Example

usage
// build.config.ts
import { defineBuildConfig } from 'unbuild';

export default defineBuildConfig({
  entries: ['src/index'],
  declaration: true,
  rollup: {
    emitCJS: true,
  },
});

About unbuild

unbuild is a unified JavaScript build system created by the UnJS team that provides a preset-based, zero-config approach to building libraries and packages. unbuild automatically infers build configuration from your package.json's exports, main, module, and types fields, generating the correct output formats without explicit configuration. Under the hood, unbuild uses Rollup for bundled builds and mkdist for file-to-file transpilation (stub mode), allowing developers to choose between fully bundled output and directory-to-directory transformation that preserves the original file structure. The stub mode is particularly useful during development — it creates lightweight wrapper files that redirect imports to your source code, enabling instant changes without rebuilding. unbuild supports TypeScript declaration generation, automatic dependency externalization, and source maps. The tool handles ESM and CommonJS output, multiple entry points, and CSS alongside JavaScript. unbuild is used to build many packages in the UnJS ecosystem including Nitro, H3, and ofetch. It is particularly well-suited for monorepo setups and library development workflows where you want minimal configuration and the ability to quickly switch between bundled and pass-through build modes.

Quick Facts

Packageunbuild
CategoryBuild Tool
Weekly Downloads500K+
LicenseMIT
Installnpm install -D unbuild

Related Packages

Browse npm Packages by Category

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