-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtsup.config.mts
More file actions
37 lines (34 loc) · 698 Bytes
/
tsup.config.mts
File metadata and controls
37 lines (34 loc) · 698 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { build, Options } from 'tsup'
const common: Options = {
entry: ['src/index.ts'],
format: ['cjs', 'esm'],
external: [],
splitting: true,
cjsInterop: true,
dts: true,
target: ['node18'],
shims: true,
tsconfig: './tsconfig.json',
}
// minify
await build({
...common,
clean: true,
minify: true,
minifySyntax: true,
minifyWhitespace: true,
minifyIdentifiers: true,
outExtension({ format }) {
return {
js: format === 'cjs' ? '.min.cjs' : format === 'esm' ? `.min.mjs` : '.min.js',
}
},
})
await build({
...common,
outExtension({ format }) {
return {
js: format === 'cjs' ? '.cjs' : format === 'esm' ? `.mjs` : '.js',
}
},
})