Examples
Copy-and-paste starter projects for common library setups with Packem
Examples
Each example is a complete, working project you can use as a starting point. Pick the one closest to what you are building.
Library starters
| Example | What it builds |
|---|---|
| Basic TypeScript Library | A simple utility package with ESM output and .d.ts declarations |
| Dual Package (ESM + CJS) | A library that ships both ESM and CJS for maximum compatibility |
| React Component Library | React components with CSS Modules, Server Components, and Storybook |
| Monorepo | Multiple packages in a single workspace with shared configuration |
Configuration recipes
| Example | What it covers |
|---|---|
| Extra Conditions | Custom export conditions in package.json validation |
Advanced
| Example | What it covers |
|---|---|
| Minify HTML Literals | Automatically minify HTML and CSS inside template literals |
| require-cjs-transformer | Transform ESM imports of CJS packages for better runtime performance |
Quick start
Copy one of these to bootstrap a new project:
# TypeScript library
npx degit visulima/packem/examples/basic-library my-lib
cd my-lib && npm install && npm run build
# React component library
npx degit visulima/packem/examples/react-library my-components
cd my-components && npm install && npm run build