Repository navigation
Expand file tree
/
Copy pathtsdown.config.ts
More file actions
65 lines (62 loc) · 1.68 KB
/
Copy pathtsdown.config.ts
File metadata and controls
65 lines (62 loc) · 1.68 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
import { defineConfig } from "tsdown";
import stripComments from "vite-plugin-strip-comments";
const pkg = await import("./package.json", { with: { type: "json" } }).then(
(m) => m.default,
);
const year = new Date().getFullYear();
const banner = `/*!
* @thednp/event-listener $package v${pkg.version} (${pkg.homepage})
* Copyright ${year} © ${pkg.author}
* Licensed under MIT (https://github.com/thednp/event-listener/blob/main/LICENSE)
*/`;
const miniBanner =
`/*! @thednp/event-listener $package v${pkg.version} | ${pkg.author} © ${year} | ${pkg.license}-License */`;
export default defineConfig([
{ // ES
entry: {
index: "src/index.ts",
},
target: "esnext",
platform: "browser",
exports: true,
format: ["esm"],
dts: true,
clean: true,
sourcemap: true,
globalName: "EventListener",
banner: banner.replace("$package", "ESM"),
plugins: [stripComments({ type: "keep-jsdoc" })],
deps: {
skipNodeModulesBundle: true,
}
},
// { // CJS
// entry: {
// index: "src/index.ts",
// },
// target: "esnext",
// platform: "neutral",
// exports: true,
// format: ["cjs"],
// dts: true,
// // clean: true,
// sourcemap: true,
// globalName: "EventListener",
// banner: banner.replace("$package", "CJS"),
// plugins: [stripComments({ type: "keep-jsdoc" })],
// },
{ // UMD
entry: {
index: "src/index.ts",
},
platform: "browser",
target: "esnext",
minify: true,
// exports: true,
format: ["umd"],
sourcemap: true,
banner: miniBanner.replace("$package", "UMD"),
globalName: "EventListener",
plugins: [stripComments({ type: "none" })],
},
]);