@culur/config-tsdown
v1.1.0
Published
Culur's tsdown configuration
Maintainers
Readme
@culur/config-tsdown
Sharing tsdown configurations.
✨ Features
The library includes several tsdown configurations for reuse.
1. Shared configuration
const sharedConfig = {
sourcemap: true,
clean: true,
dts: true,
entry: [
'src/**/*.ts', //
'!src/**/*.test.ts',
'!src/**/*.spec.ts',
],
treeshake: true,
};2. There are 3 complete configurations
| Name | Format |
| --------- | ------------ |
| esm | esm |
| cjs | cjs |
| esm_cjs | esm, cjs |
💿 Installation
Add @culur/config-tsdown dependency to your project.
# Using npm
npm install @culur/config-tsdown --save-dev
# Using pnpm
pnpm install @culur/config-tsdown --dev
# Using yarn
yarn add @culur/config-tsdown --devOther packages:
- You also need to install
tsdownandtypescriptpackages indevDependencies.
📖 Usage
1. Use the config directly
In tsdown.config.ts, use:
import { cjs, esm, esm_cjs } from '@culur/config-tsdown';
// format 'esm'
export default esm;
// format 'cjs'
export default cjs;
// format 'esm_cjs'
export default esm_cjs;2. Overwrite some properties from the shared configuration
In tsdown.config.ts, use defineConfig:
import { defineConfig, esm } from '@culur/config-tsdown';
export default defineConfig({
...esm,
//...
});🔄 Migrate from tsup
If you are migrating from @culur/config-tsup, you can follow these steps:
- Replace
@culur/config-tsupwith@culur/config-tsdown. - Update your
tsup.config.tstotsdown.config.ts. - Change imports from
@culur/config-tsupto@culur/config-tsdown.
For more details on migrating from tsup to tsdown, please refer to the official tsdown migration guide.
📜 Scripts
Some commonly used scripts in package.json.
{
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.cjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
}
},
"files": ["CHANGELOG.md", "LICENSE", "README.md", "dist", "src"],
"scripts": {
"build": "tsdown"
}
}🗃️ Changelog
See CHANGELOG for more information on what has changed recently.
🔒 License
See LICENSE for license rights and limitations (MIT).
