{"id":16856,"library":"mini-tsdown","title":"Mini-TSDown: Minimal TypeScript Bundler","description":"mini-tsdown is a minimal TypeScript library bundler, currently at version 0.1.9, designed primarily for learning purposes and providing a performant build experience. It leverages the Rust-based bundler Rolldown and the Rust-based parser/linter Oxc, offering fast bundling for TypeScript projects. The tool supports multi-format output (ESM and CJS), automatically generates TypeScript declaration files (.d.ts), includes a watch mode for development, and features a flexible hook system for customizing the build lifecycle. Configuration can be managed via dedicated config files (TS, JS, JSON) or CLI options. While its release cadence is not formally defined due to its early stage and \"learning purposes\" designation, it provides a lightweight, performant alternative focused on TypeScript library bundling, differentiating itself from larger, more general-purpose bundlers by its minimal approach and Rust-powered core.","status":"active","version":"0.1.9","language":"javascript","source_language":"en","source_url":"https://github.com/OPBR/mini-tsdown","tags":["javascript","bundler","typescript","rolldown","build-tool","esm","cjs"],"install":[{"cmd":"npm install mini-tsdown","lang":"bash","label":"npm"},{"cmd":"yarn add mini-tsdown","lang":"bash","label":"yarn"},{"cmd":"pnpm add mini-tsdown","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for TypeScript compilation and type declaration generation.","package":"typescript","optional":false}],"imports":[{"note":"Primarily used in `mini-tsdown.config.ts` for type-safe configuration. Always use ESM `import`.","wrong":"const defineConfig = require('mini-tsdown').defineConfig","symbol":"defineConfig","correct":"import { defineConfig } from 'mini-tsdown'"},{"note":"The core programmatic API function. Returns a Promise.","wrong":"const build = require('mini-tsdown').build","symbol":"build","correct":"import { build } from 'mini-tsdown'"},{"note":"Used for type annotations when defining build configurations programmatically or for inline options.","symbol":"BuildOptions","correct":"import type { BuildOptions } from 'mini-tsdown'"}],"quickstart":{"code":"import { build } from 'mini-tsdown';\n\nasync function bundleLibrary() {\n  try {\n    await build({\n      entry: 'src/index.ts', // Adjust to your main entry point\n      format: ['esm', 'cjs'],\n      outDir: 'dist',\n      dts: true,\n      sourcemap: true,\n      external: ['some-peer-dep'], // Example: mark a package as external\n    });\n    console.log('Build complete successfully!');\n  } catch (error) {\n    console.error('Build failed:', error);\n    process.exit(1);\n  }\n}\n\nbundleLibrary();","lang":"typescript","description":"Shows how to programmatically bundle a TypeScript project, generating ESM and CJS outputs with type declarations and sourcemaps."},"warnings":[{"fix":"Review the latest README and changelog (if available) for each update. Pin exact versions in `package.json` to avoid unexpected breakage in production environments.","message":"As `mini-tsdown` is an early-stage project (v0.1.9) created 'for learning purposes', its API is subject to frequent and potentially breaking changes without strict adherence to semantic versioning. Configuration options, CLI flags, and programmatic interfaces may change significantly between minor versions.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Ensure `typescript@^5.0.0` or `typescript@^6.0.0` is installed as a `devDependency` in your project: `pnpm add -D typescript` or `npm install --save-dev typescript`.","message":"`mini-tsdown` requires a peer dependency on `typescript` (v5.0.0 or v6.0.0). Failing to install a compatible version will prevent type declaration generation and potentially other TypeScript-related features from working correctly, leading to build failures.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Understand the option precedence: CLI flags override configuration file settings. Use the config file for default build settings and CLI for temporary overrides or specific, one-off build commands.","message":"CLI options take precedence over options defined in `mini-tsdown.config.ts`. If both are provided for the same setting (e.g., `--format esm` via CLI and `format: ['cjs']` in config), the CLI value will always override the configuration file setting.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Install TypeScript as a development dependency: `pnpm add -D typescript` or `npm install --save-dev typescript`.","cause":"The `typescript` peer dependency is missing from your project's `devDependencies`.","error":"Error: Cannot find module 'typescript'"},{"fix":"Verify the `entry` path in your `mini-tsdown.config.ts` or the CLI command `npx mini-tsdown <entry-file>` points to an existing file in your project structure.","cause":"The specified entry file either does not exist or the path provided is incorrect.","error":"Error: Entry point 'src/index.ts' not found."},{"fix":"Ensure your `mini-tsdown.config.ts` uses ESM `import { defineConfig } from 'mini-tsdown'` and that your environment (tsconfig `module` and `moduleResolution` settings) is configured for TypeScript with ESM.","cause":"Attempting to use `defineConfig` with CommonJS `require()` syntax in a TypeScript configuration file, which expects ESM `import`.","error":"TypeError: defineConfig is not a function"}],"ecosystem":"npm","meta_description":null}