-
-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathtsup.config.ts
More file actions
35 lines (28 loc) · 719 Bytes
/
tsup.config.ts
File metadata and controls
35 lines (28 loc) · 719 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
35
import { defineConfig } from "tsup"
import pkg from "./package.json"
function getEntriesFromExports(exportsField: any) {
const entries: string[] = []
for (const key in exportsField) {
const value = exportsField[key]
if (typeof value === "object" && value.import) {
const path = value.import
.replace("./dist/esm/", "./src/")
.replace(/\.js$/, ".ts")
entries.push(path)
}
}
return entries
}
export default defineConfig(() => {
const entries = getEntriesFromExports(pkg.exports)
return {
entry: entries,
format: ["esm"],
dts: true,
outDir: "dist/esm",
sourcemap: true,
clean: true,
splitting: false,
external: ["payload"],
}
})