-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
tsup.config.ts
44 lines (41 loc) · 1017 Bytes
/
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
import { defineConfig } from "tsup"
import { esbuildPluginFilePathExtensions as fpe } from "esbuild-plugin-file-path-extensions"
export default defineConfig([
// for bundlers like vite, rollup, esbuild, webpack etc
{
entry: ["src/**.ts"],
format: ["esm"],
splitting: false,
sourcemap: true,
clean: true,
dts: true,
outExtension: ({ format }) => ({ js: format === "cjs" ? ".cjs" : ".mjs" }),
esbuildPlugins: [fpe()],
},
// common js for node and other backend runtimes
{
entry: ["src/index.ts"],
format: ["cjs"],
splitting: false,
sourcemap: true,
clean: true,
dts: true,
outExtension: ({ format }) => ({
js: format === "cjs" ? ".cjs" : ".mjs",
}),
},
// bundle js for browsers/cdn
{
entry: {
bundle: "src/index.ts",
},
format: ["esm"],
splitting: false,
sourcemap: true,
clean: true,
dts: true,
outExtension: ({ format }) => ({
js: format === "cjs" ? ".cjs" : ".mjs",
}),
},
])