-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ts
56 lines (50 loc) · 1014 Bytes
/
build.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
46
47
48
49
50
51
52
53
54
55
56
import { $ } from "bun";
import { build, type Options } from "tsup";
const config = {
bundle: true,
clean: true,
dts: true,
entry: ["./src/**/*.ts"],
minify: true,
outDir: "./dist",
sourcemap: false,
splitting: false,
target: "node23",
treeshake: "smallest",
} satisfies Options;
await $`rm -rf ./dist`;
await Promise.all([
build({
...config,
format: "cjs",
}),
build({
...config,
format: "esm",
outExtension: () => {
return { js: ".mjs" };
},
}),
]);
// import { defineConfig } from 'npm:tsup@^8.1.0';
// export default defineConfig([
// {
// entry: ['./src/index.ts'],
// clean: true,
// format: ['esm', 'cjs'],
// minify: false,
// dts: true,
// outDir: './dist',
// },
// {
// entry: ['./src/index.ts'],
// clean: true,
// format: ['esm', 'cjs'],
// minify: true,
// dts: false,
// outDir: './dist',
// outExtension: ({ format }) => ({
// js: format === 'cjs' ? '.min.cjs' : '.min.js',
// }),
// },
// ]);