@robonen/tsdown
Shared tsdown build configuration for every @robonen package — one source of truth for output formats, declarations, and bundle hygiene.
Every library in this monorepo ships dual ESM/CJS builds with type declarations, a clean dist, and a consistent license banner. Re-declaring that in each package's tsdown.config.ts is repetitive and drifts over time. @robonen/tsdown exports a single sharedConfig object you spread into defineConfig, then add only what is package-specific — usually just entry and tsconfig.
Dual ESM + CJS
Emits both esm and cjs formats so packages work in modern bundlers and legacy require setups alike.
Types included
dts: true generates .d.ts declarations on every build — no separate type pipeline to maintain.
Clean, stable output
clean: true wipes dist first and hash: false keeps file names deterministic for predictable publishing.
Spread & override
It is a plain object typed as InlineConfig — spread it, override any field, and let editor autocomplete guide you.
Install
Add the config package and tsdown itself as dev dependencies:
pnpm add -D @robonen/tsdown tsdownUsage
Create tsdown.config.ts in your package, spread sharedConfig, and supply your entry points:
import { defineConfig } from 'tsdown';
import { sharedConfig } from '@robonen/tsdown';
export default defineConfig({
...sharedConfig,
tsconfig: './tsconfig.src.json',
entry: ['src/index.ts'],
}); Because sharedConfig is a normal object, you can override or extend any field after spreading — add plugins, extra entries, or tweak the declaration options:
import { defineConfig } from 'tsdown';
import { sharedConfig } from '@robonen/tsdown';
import Vue from 'unplugin-vue/rolldown';
export default defineConfig({
...sharedConfig,
entry: ['src/index.ts', 'src/*/index.ts'],
plugins: [Vue({ isProduction: true })],
// layer on top of the shared defaults
dts: { vue: true },
});Where to next
- sharedConfig — the full list of defaults and their exact values.
- Read the guide sections below for the conventions baked into the shared build and tips for package-specific overrides.
Overview
Shared tsdown configuration for @robonen packages