-
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathtsup.config.ts
More file actions
38 lines (36 loc) · 810 Bytes
/
Copy pathtsup.config.ts
File metadata and controls
38 lines (36 loc) · 810 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
import { defineConfig, type Options } from 'tsup';
const baseOptions: Options = {
clean: true,
dts: true,
entry: ['src/browser.ts', 'src/cairo.ts', 'src/napi-rs.ts', 'src/skia.ts'],
minify: false,
sourcemap: true,
target: 'es2020',
tsconfig: 'src/tsconfig.json',
keepNames: true,
treeshake: true,
external: ['node:util', 'canvas', 'skia-canvas', '@napi-rs/canvas']
};
export default [
defineConfig({
...baseOptions,
outDir: 'dist/cjs',
format: 'cjs',
outExtension: () => ({ js: '.cjs' })
}),
defineConfig({
...baseOptions,
outDir: 'dist/esm',
format: 'esm',
outExtension: () => ({ js: '.mjs' })
}),
defineConfig({
...baseOptions,
entry: ['src/browser.ts'],
globalName: 'CanvasConstructor',
dts: false,
minify: 'terser',
outDir: 'dist/iife',
format: 'iife'
})
];