@halvaradop/tsup-config
v1.1.1
Published
Reusable tsup build configuration for @halvaradop projects.
Maintainers
Readme
@halvaradop/tsup-config
A robust, shareable tsup configuration for building scalable JavaScript and TypeScript projects.
This package is part of the @halvaradop/configs monorepo, which provides standardized configurations for various development tools.
Installation
Install the package as a development dependency in your project:
# Using pnpm (recommended)
pnpm add -D @halvaradop/tsup-config
# Using npm
npm install -D @halvaradop/tsup-config
# Using yarn
yarn add -D @halvaradop/tsup-configPeer Dependency: Requires
tsupversion^8.0.0or higher.
Configuration Overview
The default configuration includes:
| Setting | Value | Description |
| -------- | ---------------- | -------------------------------------- |
| format | ["esm", "cjs"] | Output both ESM and CommonJS bundles |
| entry | ["src"] | Entry point(s) for the build |
| dts | true | Generate TypeScript declaration files |
| clean | true | Clean output directory before building |
| minify | true | Minify the output bundles |
Usage
Basic Setup
Create a tsup.config.js in your project root:
import { defineConfig } from "tsup"
import { tsupConfig } from "@halvaradop/tsup-config"
export default defineConfig(tsupConfig)Alternative Import
You can also use the default export:
import { defineConfig } from "tsup"
import tsupConfig from "@halvaradop/tsup-config"
export default defineConfig(tsupConfig)Customizing the Configuration
Extend or override the defaults as needed:
import { defineConfig } from "tsup"
import { tsupConfig } from "@halvaradop/tsup-config"
export default defineConfig({
...tsupConfig,
entry: ["src/index.ts"],
sourcemap: true,
})Recommended Scripts
Add these scripts to your package.json for streamlined development:
{
"scripts": {
"dev": "tsup --watch",
"build": "tsup"
}
}Related Packages
Explore other configurations in the @halvaradop/configs ecosystem:
@halvaradop/eslint-config– ESLint configuration@halvaradop/prettier-config– Prettier configuration@halvaradop/tsconfig– TypeScript configuration
License
MIT © Hernan Alvarado
Changelog
See CHANGELOG.md for details about changes in each version.
For more details on tsup, see the official documentation.
