-
Notifications
You must be signed in to change notification settings - Fork 1
/
tsup.config.ts
45 lines (43 loc) · 1.06 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
import { defineConfig, type Options } from 'tsup'
import { nodeModulesPolyfillPlugin } from 'esbuild-plugins-node-modules-polyfill'
import pkg from './package.json' assert { type: 'json' }
const sharedConfig: Options = {
dts: true,
env: { VERSION: pkg.version },
format: ['cjs', 'esm', 'iife'],
keepNames: true,
publicDir: 'public',
splitting: false,
esbuildPlugins: [
nodeModulesPolyfillPlugin({
globals: {
Buffer: false,
},
modules: {
'stream/web': 'empty',
fallback: 'empty',
},
}),
],
}
export default defineConfig((options): Options[] => [
{
...sharedConfig,
clean: !options.watch, // only clean once when not watching
minify: !options.watch,
globalName: 'ChameleonUltraJS',
entry: ['src/index.ts'],
},
{
...sharedConfig,
minify: !options.watch,
entry: [
'src/Crypto1.ts',
'src/plugin/Debug.ts',
'src/plugin/DfuZip.ts',
'src/plugin/SerialPortAdapter.ts',
'src/plugin/WebbleAdapter.ts',
'src/plugin/WebserialAdapter.ts',
],
},
])