@culur/config-tsup
v1.2.1
Published
Culur's tsup configuration
Downloads
7
Readme
@culur/config-tsup
Sharing tsup configurations.
✨ Features
The library includes several tsup configurations for reuse.
1. Shared configuration
const sharedConfig = {
sourcemap: true,
clean: true,
dts: true,
entry: [
'src/**/*.ts', //
'!src/**/*.test.ts',
'!src/**/*.spec.ts',
],
treeshake: 'recommended',
};
2. There are 3 complete configurations
| Name | Format | Splitting |
| --------- | ------------ | --------- |
| esm
| esm
| true
|
| cjs
| cjs
| |
| esm_cjs
| esm
, cjs
| true
|
💿 Installation
Add @culur/config-tsup
dependency to your project.
# Using npm
npm install @culur/config-tsup --save-dev
# Using pnpm
pnpm install @culur/config-tsup --dev
# Using yarn
yarn add @culur/config-tsup --dev
Other packages:
- You also need to install
tsup
andtypescript
packages indevDependencies
.
📖 Usage
1. Use the config directly
In tsup.config.ts
, use:
import { cjs, esm, esm_cjs } from '@culur/config-tsup';
// 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 tsup.config.ts
, use defineConfig
:
import { defineConfig, esm } from '@culur/config-tsup';
export default defineConfig({
...esm,
plugins: [
//...
],
});
📜 Scripts
Some commonly used scripts in package.json
.
{
"exports": {
".": {
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
}
},
"files": ["CHANGELOG.md", "LICENSE", "README.md", "dist", "src"],
"scripts": {
"build": "tsup"
}
}
🗃️ Changelog
See CHANGELOG for more information on what has changed recently.
🔒 License
See LICENSE for license rights and limitations (MIT).