-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtsup.config.ts
More file actions
52 lines (51 loc) · 1.32 KB
/
tsup.config.ts
File metadata and controls
52 lines (51 loc) · 1.32 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
49
50
51
52
import { defineConfig } from 'tsup';
export default defineConfig([
// Node builds (ESM + CJS) for CLI and API
{
entry: ['src/index.ts', 'src/cli.ts'],
format: ['esm', 'cjs'],
target: 'es2020',
// Enable code-splitting for ESM builds to share common chunks
splitting: true,
sourcemap: true,
clean: true,
dts: true,
outDir: 'dist',
// Minify the output for production usage
minify: true,
// Do not bundle node_modules for Node builds
skipNodeModulesBundle: true,
},
// Browser build (ESM) for programmatic API only
{
entry: ['src/index.ts'],
format: ['esm'],
target: 'es2019',
splitting: false,
sourcemap: true,
clean: false,
// No declaration files needed for the browser bundle
dts: false,
outDir: 'dist/browser',
// Minify the output for production usage
minify: true,
// Bundle all dependencies for browser
skipNodeModulesBundle: false,
},
// UMD build for <script> tag / CDN usage
{
entry: ['src/index.ts'],
format: ['iife'],
globalName: 'domhash',
target: 'es2019',
splitting: false,
sourcemap: true,
clean: false,
dts: false,
outDir: 'dist/umd',
// Minify the output for production usage
minify: true,
// Bundle all dependencies for browser
skipNodeModulesBundle: false,
}
]);