-
Notifications
You must be signed in to change notification settings - Fork 385
Expand file tree
/
Copy pathtsup.config.ts
More file actions
42 lines (37 loc) · 942 Bytes
/
tsup.config.ts
File metadata and controls
42 lines (37 loc) · 942 Bytes
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
import { defineConfig } from 'tsup';
const PUBLISH_TO_NPM = process.env.PUBLISH_MODE === 'true';
// IIFE build with globalName for tests
const iifeBuild = defineConfig({
entry: { 'mp4box.all': 'entries/all.ts' },
target: 'es2017',
format: ['iife'],
globalName: 'MP4Box',
tsconfig: 'tsconfig.build.json',
splitting: false,
sourcemap: true,
minify: true,
clean: true,
dts: false,
});
// CJS and ESM builds for distribution
const regularBuild = defineConfig({
entry: {
'mp4box.all': 'entries/all.ts',
'mp4box.simple': 'entries/simple.ts',
},
target: 'es2022',
format: ['cjs', 'esm'],
tsconfig: 'tsconfig.build.json',
splitting: false,
sourcemap: true,
minify: false,
clean: PUBLISH_TO_NPM,
dts: true,
});
const build: Array<typeof iifeBuild | typeof regularBuild> = [];
if (PUBLISH_TO_NPM) {
build.push(regularBuild);
} else {
build.push(iifeBuild, regularBuild);
}
export default build;