Guide
Learn how to install, configure, and ship production bundles with Packem.
Guide
Whether you are publishing your first npm package or maintaining a monorepo with dozens of libraries, these guides walk you through every step — from installation to production builds.
Recommended reading order
If you are new to Packem, start at the top and work your way down. Each guide builds on the previous one.
- Introduction — What Packem is, how it works, and when to use it.
- Getting Started — Install Packem and create your first bundle in under five minutes.
- Configuration — Customize entry points, output formats, and build behavior.
- Transformers — Pick the right compiler (esbuild, swc, OXC, sucrase, or TypeScript).
- CSS Processing — Add support for CSS, Sass, Less, Stylus, PostCSS, and CSS Modules.
- Debug and Profiling — Diagnose build issues and measure performance.
Working with Packem
Task-focused guides for everyday development:
- package.json Setup — Drive entries, formats, and declarations from your
package.json. - TypeScript — Declaration files, isolated declarations, and type checking.
- React — Build React component libraries, including Server Components.
- Multi-Runtime Builds — Target Node.js, browser, edge, and react-server from one build.
- Plugins — Extend the build with Rollup plugins.
- Optimization — Minification, tree shaking, and bundle size.
- Watch Mode — Rebuild automatically during development.
- CLI — Every command and flag the
packemCLI offers.
Migrating to Packem
Coming from another bundler? Start here:
- From tsup — Automated migration via
packem migrate. - From unbuild — Automated migration via
packem migrate. - From Rollup — Map your Rollup config to Packem.
- From webpack — Move a webpack library build to Packem.
Troubleshooting
When something goes wrong:
- Common Issues — Frequent problems and their fixes.
- TypeScript — Declaration and type-checking errors.
- CSS — Styling and preprocessor problems.
- Build Errors — Diagnose and resolve build failures.
Already familiar with Packem?
Jump straight to the reference material:
- Configuration Options — Every option explained with examples.
- API Reference — Programmatic usage, hooks, and plugin development.
- Examples — Copy-and-paste starter projects for common setups.