-
Notifications
You must be signed in to change notification settings - Fork 58
/
tsup.config.ts
36 lines (29 loc) · 881 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
import $esm from 'esm-utils'
import { defineConfig } from 'tsup'
const { __dirname } = $esm(import.meta)
process.env.NODE_ENV ||= 'development'
const prod = process.env.NODE_ENV === 'production'
export default defineConfig({
entry: {
'bin': 'src/bin.ts',
'processContent.worker': 'src/utils/processContent/worker/index.worker.ts',
},
format: 'esm',
platform: 'node',
target: 'node16',
clean: true,
minify: prod,
env: {
NODE_ENV: process.env.NODE_ENV,
},
// NOTE: puppeteer-intercept-and-modify-requests 这个包 esm build 有问题
noExternal: ['puppeteer-intercept-and-modify-requests'],
external: ['why-is-node-running'],
esbuildOptions(options, context) {
// init
options.external ||= []
options.external.push(__dirname + '/package.json')
// use ascii in prod
options.charset = prod ? undefined : 'utf8'
},
})