tsdown

Bundle TypeScript libraries into dual ESM and CJS outputs with .d.ts generation.

Updated Jan 6, 2026
One-click install
npx skills add https://github.com/vito1317/security-one-waf-website --skill tsdown-vito1317
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tsdown
Source: https://github.com/vito1317/security-one-waf-website/tree/main/.tessl/tiles/onmax/nuxt-skills/skills/tsdown
Command: npx skills add https://github.com/vito1317/security-one-waf-website --skill tsdown-vito1317

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

TSdown addresses the challenge of bundling TypeScript libraries into robust, distributable formats by automating dual output generation and type declarations.

Core Features & Use Cases

  • Generates dual ESM and CJS bundles with declarations for library packages.
  • Validates exports and package.json integration to ensure correct publishing.
  • Use Case: A library author publishes a TS library to npm and needs both module formats and accurate type definitions.

Quick Start

Install tsdown and run a build to generate dual ESM/CJS bundles for a TypeScript library.

Frequently Asked Questions about tsdown

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I bundle a TypeScript library into both ESM and CJS formats?

To bundle a TypeScript library into dual ESM and CJS formats, you can configure an automated build process that generates both output formats alongside .d.ts type declarations for npm publishing.

Why do I need to generate .d.ts declarations when publishing a TypeScript library?

Generating .d.ts declarations is needed when publishing a TypeScript library because it provides accurate type definitions for consumers, ensuring type-safe distribution and correct IDE autocomplete across different module systems.

What is the best way to validate package.json exports for a dual ESM and CJS package?

Validating package.json exports for a dual ESM and CJS package requires checking the export map configuration to ensure correct entry points, output formats, and module resolution for library consumers.

Does this bundling approach work for TypeScript libraries with multiple entry points?

Yes, this bundling approach works for TypeScript libraries with multiple entry points, supporting common build scenarios like single-entry packages and multiple formats while applying export map validation for type-safe distribution.

Can I use this to prepare a shared component library for npm publishing?

You can use this to prepare a shared component library for npm publishing by bundling TypeScript source code into dual ESM and CJS outputs with automatic declaration generation and validated export configuration.

What are the limitations of bundling TypeScript libraries into dual formats without export validation?

Bundling TypeScript libraries into dual formats without export validation risks incorrect package.json integration, broken module resolution, and missing type declarations, which prevents successful type-safe distribution to npm consumers.