-
Notifications
You must be signed in to change notification settings - Fork 2
/
tsup.config.ts
43 lines (41 loc) · 1.17 KB
/
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
import { readFileSync, rmSync } from 'node:fs'
import { transformSync } from 'esbuild'
import { defineConfig, type Options } from 'tsup'
function getConfig(): Options[] {
rmSync('./dist', { recursive: true, force: true })
const fontCSS = transformSync(
readFileSync('./src/utils/devtoolsCSS/font.css', 'utf-8'),
{ minify: true, loader: 'css' },
)
const scrollbarCSS = transformSync(
readFileSync('./src/utils/devtoolsCSS/scrollbar.css', 'utf-8'),
{ minify: true, loader: 'css' },
)
return [
{
entry: {
index: './src/entry/index.ts',
utils: './src/utils/index.ts',
provider: './src/provider/index.ts',
},
format: ['esm', 'cjs'],
dts: true,
treeshake: true,
external: ['electron', 'vite'],
define: {
__FONT_CSS__: JSON.stringify(fontCSS?.code.replace(/\n/g, '') || ''),
__SCROLLBAR_CSS__: JSON.stringify(scrollbarCSS?.code.replace(/\n/g, '') || ''),
},
},
{
entry: {
vite: './src/vite/index.ts',
},
format: 'esm',
dts: true,
treeshake: true,
external: ['electron', 'vite'],
},
]
}
export default defineConfig(getConfig())