-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtsup.config.ts
More file actions
34 lines (30 loc) · 818 Bytes
/
tsup.config.ts
File metadata and controls
34 lines (30 loc) · 818 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
import { existsSync, readdirSync } from 'node:fs';
import { join } from 'node:path';
import { defineConfig } from 'tsup';
const languagesDir = 'src/languages';
const languageEntries = existsSync(languagesDir)
? Object.fromEntries(
readdirSync(languagesDir)
.filter((file) => file.endsWith('.ts'))
.map((file) => {
const slug = file.replace(/\.ts$/, '');
return [`languages/${slug}`, join(languagesDir, file)];
}),
)
: {};
export default defineConfig({
entry: {
api: 'src/api.ts',
detect: 'src/detect.ts',
'detect-slugs': 'src/detect-slugs.ts',
index: 'src/index.ts',
i18n: 'src/i18n.ts',
...languageEntries,
},
format: ['esm', 'cjs'],
dts: true,
splitting: false,
clean: true,
treeshake: true,
sourcemap: false,
});