forked from fuma-nama/fumadocs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtsup.config.ts
50 lines (46 loc) · 1.09 KB
/
tsup.config.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
import { defineConfig } from 'tsup';
import { injectImport } from './build-config';
const exportedComponents = [
'type-table',
'image-zoom',
'files',
'tabs',
'accordion',
'steps',
'inline-toc',
'callout',
'api',
'card',
'heading',
'codeblock',
'banner',
'dialog/search',
'dialog/search-default',
'dialog/search-algolia',
'dialog/search-orama',
'layout/root-toggle',
'layout/language-toggle',
];
const injectImports = [
'./src/page.tsx',
'./src/mdx.tsx',
'./src/layouts/docs.tsx',
'./src/layouts/home.tsx',
'./src/components/api.tsx',
];
export default defineConfig({
entry: [
`./src/components/{${exportedComponents.join(',')}}.tsx`,
'./src/layouts/{docs,shared,home}.tsx',
'./src/{i18n,home-layout,layout,page,provider,mdx,tailwind-plugin,og}.{ts,tsx}',
'./src/**/*.client.tsx',
],
external: ['server-only', './image-zoom.css', 'tailwindcss'],
async onSuccess() {
const replaceImports = injectImports.map((src) => injectImport(src));
await Promise.all(replaceImports);
},
format: 'esm',
dts: true,
target: 'esnext',
});