-
-
Notifications
You must be signed in to change notification settings - Fork 157
Expand file tree
/
Copy pathtsdown.config.mts
More file actions
48 lines (47 loc) · 1.28 KB
/
tsdown.config.mts
File metadata and controls
48 lines (47 loc) · 1.28 KB
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
import { defineConfig } from 'tsdown'
export default defineConfig([
{
name: 'node',
entry: [
'./src/index.ts',
'./src/presets/node.ts',
'./src/utils/node/index.ts',
'./src/RemoteHttpInterceptor.ts',
'./src/interceptors/ClientRequest/index.ts',
'./src/interceptors/XMLHttpRequest/index.ts',
'./src/interceptors/fetch/index.ts',
],
external: ['_http_common'],
outDir: './lib/node',
platform: 'node',
target: 'node20',
outExtensions: (context) => ({
js: context.format === 'cjs' ? '.cjs' : '.mjs',
dts: context.format === 'cjs' ? '.d.cts' : '.d.mts',
}),
format: ['cjs', 'esm'],
sourcemap: true,
dts: true,
},
{
name: 'browser',
entry: [
'./src/index.ts',
'./src/presets/browser.ts',
'./src/interceptors/XMLHttpRequest/index.ts',
'./src/interceptors/fetch/index.ts',
'./src/interceptors/WebSocket/index.ts',
],
outDir: './lib/browser',
platform: 'browser',
target: 'chrome120',
format: ['cjs', 'esm'],
outExtensions: (context) => ({
js: context.format === 'cjs' ? '.cjs' : '.mjs',
dts: context.format === 'cjs' ? '.d.cts' : '.d.mts',
}),
sourcemap: true,
dts: true,
tsconfig: './tsconfig.browser.json',
},
])