@tcd-devkit/tsup-config
v0.0.9
Published
Shareable tsup configuration for building TypeScript libraries. Provides sensible defaults, focusing on reliable declaration map generation and ESM/CJS compatibility.
Downloads
19
Maintainers
Readme
@tcd-devkit/tsup-config
Shareable tsup configuration for building TypeScript libraries. This configuration provides sensible defaults, focusing on reliable declaration map (.d.ts.map) generation and ESM/CJS compatibility.
Features
- Sensible defaults for
tsupbuilds. - Reliable generation of TypeScript declaration maps.
- Configurable and extensible for various project needs.
- Outputs both ESM and CJS modules by default.
Installation
To use this configuration in your project, install it along with tsup and typescript:
pnpm add -D @tcd-devkit/tsup-config tsup typescriptUsage
Create a tsup.config.ts file in the root of your package and import the base configuration. You can then extend it as needed.
import { defineConfig } from 'tsup';
import baseConfig from '@tcd-devkit/tsup-config';
export default defineConfig((options) => ({
...baseConfig,
entry: ['src/index.ts'], // Your library's entry point(s)
// Add any specific overrides or additional options here
// For example:
// outDir: 'dist',
// splitting: false,
// sourcemap: true,
// clean: true,
...options, // Pass through CLI options
}));Multiple Configurations
The package also exports named configurations if you need more specific setups or want to combine them. For example, libConfig is the default.
import { defineConfig } from 'tsup';
import { libConfig } from '@tcd-devkit/tsup-config'; // Or other named configs
export default defineConfig((options) => ({
...libConfig, // Use a specific named config
entry: ['src/index.ts'],
...options,
}));Refer to the tsup documentation for all available options.
License
MIT
