Skip to content

Commit 6860d20

Browse files
authored
Merge pull request #6 from taj54/main
feat: Migrate tsup configuration to tsup.config.ts
2 parents aea2070 + 99fc6ba commit 6860d20

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"dist"
1818
],
1919
"scripts": {
20-
"build": "tsup src/index.tsx --format esm,cjs --dts",
21-
"dev": "tsup src/index.tsx --watch --format esm,cjs",
20+
"build": "tsup",
21+
"dev": "tsup --watch",
2222
"test": "vitest run",
2323
"clean": "rm -rf dist",
2424
"prepare": "pnpm build",

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"compilerOptions": {
33
"target": "ES2020",
44
"module": "ESNext",
5-
"moduleResolution": "Node",
5+
"moduleResolution": "bundler",
66
"lib": ["DOM", "ES2020"],
77
"types": ["vitest/globals"],
88
"allowJs": true,

tsup.config.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { defineConfig } from 'tsup';
2+
import pkg from './package.json';
3+
4+
export default defineConfig((options) => ({
5+
export default defineConfig((options) => ({
6+
entry: ['src/index.tsx'],
7+
format: ['esm', 'cjs'],
8+
outExtension: ext => ({
9+
esm: '.mjs',
10+
cjs: '.cjs',
11+
}),
12+
dts: true,
13+
watch: options.watch,
14+
clean: true,
15+
}));
16+
banner: {
17+
js: `/**
18+
* ${pkg.name} v${pkg.version}
19+
* Author: ${pkg.author}
20+
*/
21+
`,
22+
},
23+
}));

0 commit comments

Comments
 (0)