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 install -D unbuild
yarn add -D unbuild
pnpm add -D unbuild
Import
// build.config.ts
import { defineBuildConfig } from 'unbuild';Quick Example
// 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
| Package | unbuild |
| Category | Build Tool |
| Weekly Downloads | 500K+ |
| License | MIT |
| Install | npm install -D unbuild |
Related Packages
tsup is a zero-config TypeScript bundler powered by esbuild, designed specifically for building Type…
Rollup is a JavaScript module bundler that compiles small pieces of code into larger, more complex b…
esbuild is an extremely fast JavaScript and TypeScript bundler and minifier written in Go that is 10…
Vite is a next-generation frontend build tool created by Evan You (creator of Vue.js) that provides …
Microbundle is a zero-configuration bundler for tiny JavaScript modules, designed to produce optimiz…
Browse npm Packages by Category
Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.