/
tsup.config.ts
45 lines (44 loc) · 952 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
40
41
42
43
44
45
import process from 'node:process'
import path from 'node:path'
import { defineConfig } from 'tsup'
import Macros from 'unplugin-macros/esbuild'
import Raw from 'unplugin-raw/esbuild'
export default defineConfig({
entry: ['./src/*.ts'],
format: ['cjs', 'esm'],
target: 'node16.14',
splitting: true,
cjsInterop: true,
watch: !!process.env.DEV,
dts: process.env.DEV
? false
: {
compilerOptions: {
composite: false,
customConditions: [],
},
},
tsconfig: '../../tsconfig.lib.json',
clean: true,
define: {
'import.meta.DEV': JSON.stringify(!!process.env.DEV),
},
esbuildPlugins: [
Raw({
transform: {
options: {
minifyWhitespace: true,
},
},
}),
Macros({
viteConfig: {
resolve: {
alias: {
'#macros': path.resolve(__dirname, 'macros/index.ts'),
},
},
},
}),
],
})