-
Notifications
You must be signed in to change notification settings - Fork 26
/
tsup.config.js
55 lines (53 loc) · 997 Bytes
/
tsup.config.js
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
import { defineConfig } from 'tsup';
const cfg = {
splitting: false,
sourcemap: true,
clean: true,
treeshake: false,
dts: true,
format: ['esm', 'cjs'],
};
export default defineConfig([
{
...cfg,
entry: {
index: 'src/generic.ts',
},
outDir: 'dist',
},
{
...cfg,
entry: {
index: 'src/nextjs/index.tsx',
},
external: ['react', 'next'],
outDir: 'dist/next',
esbuildOptions: (options) => {
// Append "use client" to the top of the react entry point
options.banner = {
js: '"use client";',
};
},
},
{
...cfg,
entry: {
index: 'src/react.tsx',
},
external: ['react'],
outDir: 'dist/react',
esbuildOptions: (options) => {
// Append "use client" to the top of the react entry point
options.banner = {
js: '"use client";',
};
},
},
{
...cfg,
entry: {
index: 'src/server/index.ts',
},
outDir: 'dist/server',
},
]);