generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvite.config.ts
64 lines (62 loc) · 1.34 KB
/
vite.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import {resolve} from 'path'
import {defineConfig} from 'vite'
import dts from 'vite-plugin-dts'
// https://vitejs.dev/guide/build.html#library-mode
export default defineConfig({
build: {
lib: {
entry: ['index.ts', 'main.ts'].map(filename =>
resolve(__dirname, `src/${filename}`)
),
fileName: (format, entryName) =>
`${entryName}.${format === 'cjs' || format === 'commonjs' ? 'c' : ''}${
format === 'es' || format === 'esm' ? 'm' : ''
}js`,
formats: ['es', 'cjs']
},
sourcemap: true,
rollupOptions: {
external: [
'assert',
'buffer',
'child_process',
'crypto',
'events',
'fs',
'fs/promises',
'http',
'https',
'net',
'os',
'path',
'perf_hooks',
'string_decoder',
'stream',
'timers',
'tls',
'url',
'util',
'worker_threads',
'zlib',
'node:buffer',
'node:fs',
'node:http',
'node:https',
'node:net',
'node:path',
'node:process',
'node:stream',
'node:stream/web',
'node:url',
'node:util',
'node:zlib'
]
}
},
esbuild: {
format: 'esm',
target: 'esnext',
define: {self: 'globalThis'}
},
plugins: [dts()]
})