bunchee
Zero-config bundler for JS/TS packages — use your package.json as the config.
➜~/project$npm install --save-dev bunchee typescript
➜~/project$cat package.json
{
"name": "coffee",
"type": "module",
"main": "./dist/index.js",
"scripts": {
"build": "bunchee"
}
}
➜~/project$
Exports File Size
. dist/index.js 5.6 kB
# Why bunchee?
- Zero config - package.json as config
- Auto-generates TypeScript declarations
- Supports ESM, CJS, or dual packages
- Tree-shakeable and monorepo friendly
# Perfect for
- npm packages and component libraries
- Node.js tools, CLI apps, and utilities
- Monorepo workspaces with shared packages
# Learn
## Entry & Convention
Files in src/ folder match export names in package.json:
+--------------------------+---------------------+
| File | Export Name |
+--------------------------+---------------------+
| src/index.ts | "." (default) |
| src/lite.ts | "./lite" |
| src/react/index.ts | "./react" |
+--------------------------+---------------------+
## Directives
Bunchee can manage multiple directives such as "use client", "use server", or "use cache" and automatically split your code into different chunks and preserve the directives properly.