generated from hemengke1997/ts-starter
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtsup.config.ts
39 lines (37 loc) · 781 Bytes
/
tsup.config.ts
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
38
39
import { defineConfig, type Options } from 'tsup'
const commonConfig = (option: Options): Options => {
return {
clean: false,
sourcemap: !!option.watch,
define: {
'import.meta.vitest': 'undefined',
},
dts: true,
minify: false,
external: [/^virtual:.*/],
shims: true,
splitting: true,
treeshake: true,
}
}
export const tsup = defineConfig((option) => [
{
entry: {
'node/index': './src/node/index.ts',
},
format: ['esm'],
target: 'node16',
platform: 'node',
...commonConfig(option),
},
{
entry: {
'node/index': './src/node/index.ts',
},
noExternal: ['on-change', 'watcher'],
format: ['cjs'],
target: 'node16',
platform: 'node',
...commonConfig(option),
},
])