-
-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathtsup.config.js
53 lines (49 loc) · 1.18 KB
/
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
import { defineConfig } from 'tsup'
const cfg = {
splitting: false,
sourcemap: true,
clean: true,
treeshake: false,
dts: true,
format: ['cjs'],
}
export default defineConfig([
// Main
{
...cfg,
entry: {
index: 'src/index.ts',
cli: 'src/cli/index.ts',
loader: 'src/loader/index.ts',
},
external: ['next-export-optimize-images'],
outDir: 'dist',
},
// Server Components
{
...cfg,
entry: {
'remote-image': 'src/components/server/remote-image.tsx',
'remote-picture': 'src/components/server/remote-picture.tsx',
},
external: ['next-export-optimize-images', '../client/image', '../client/picture'],
outDir: 'dist/components/server',
},
// Client Components
{
...cfg,
entry: {
image: 'src/components/client/image.tsx',
'legacy/image': 'src/components/client/legacy/image.tsx',
picture: 'src/components/client/picture.tsx',
},
external: ['next-export-optimize-images'],
outDir: 'dist/components/client',
esbuildOptions: (options) => {
// Append "use client" to the top of the react entry point
options.banner = {
js: '"use client";',
}
},
},
])