-
-
Notifications
You must be signed in to change notification settings - Fork 130
/
tsup.config.ts
46 lines (43 loc) · 1.14 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
44
45
46
import { Options, defineConfig } from 'tsup'
const nodeConfig: Options = {
entry: [
'./src/index.ts',
'./src/presets/node.ts',
'./src/RemoteHttpInterceptor.ts',
'./src/interceptors/ClientRequest/index.ts',
'./src/interceptors/XMLHttpRequest/index.ts',
'./src/interceptors/fetch/index.ts',
],
outDir: './lib/node',
platform: 'node',
format: ['cjs', 'esm'],
sourcemap: true,
dts: true,
esbuildOptions(options) {
options.alias = {
[`internal:brotli-decompress`]:
'./src/interceptors/fetch/utils/brotli-decompress.ts',
}
},
}
const browserConfig: Options = {
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',
format: ['cjs', 'esm'],
sourcemap: true,
dts: true,
esbuildOptions(options) {
options.alias = {
[`internal:brotli-decompress`]:
'./src/interceptors/fetch/utils/brotli-decompress.browser.ts',
}
},
}
export default defineConfig([nodeConfig, browserConfig])