The Complete Guide to packaging Libraries
summary
Starts with a simple ESM math library then shows exactly how package.json exports, types and files must look to publish an open-source npm package, how to add CJS builds and node/browser conditions, and when to use specialized builders like TSUP or Rollup versus raw JS with JSDoc for types. Covers multiple entry points, sideEffects, npm pack to verify what publishes, common pitfalls (wrong extensions, types order), and a linting tool that checks packages before publish.
AI-written summary · about
chapters (15)
- 0:00Intro
- 1:29Overview
- 3:48A math library
- 4:56Add type safety
- 6:42ESM vs CJS
- 7:13Export both ESM and CJS
- 8:43Multiple entries
- 10:54Build tools
- 11:39Specialized build tool (tsup)
- 12:17Handle special files
- 13:33Simplify type safety
- 15:06Simplify ESM and CJS
- 15:45Export raw for private packages
- 19:06Many little rules
- 21:03publint.dev
related talks
24mPublishing in the JavaScript Ecosystem & Keeping Users Happy
23mPublishing in JavaScript Ecosystem: How to Keep Everyone Happy?
32mThe "Perfect" Tooling Library
34mTowards a simpler JavaScript ecosystem
28mCreate & Publish Angular Libs like a PRO
24mThe Ins-and-Outs of Publishing a Module to npm
22mtsdown: One tool to bundle them all
01h 01mUseful Tools and Utils for JS Development
