-
-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathtsdown.config.ts
More file actions
75 lines (72 loc) · 1.88 KB
/
Copy pathtsdown.config.ts
File metadata and controls
75 lines (72 loc) · 1.88 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
66
67
68
69
70
71
72
73
74
75
import { defineConfig, type UserConfig } 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 = `/*!
* SVGPathCommander v${pkg.version} (${pkg.homepage})
* Copyright ${year} © ${pkg.author}
* Licensed under MIT (https://github.com/thednp/svg-path-commander/blob/master/LICENSE)
*/`;
const miniBanner = `/*! SVGPathCommander $package v${pkg.version} | ${pkg.author} © ${year} | ${pkg.license}-License */`;
const config: UserConfig = {
exports: true,
dts: true,
clean: true,
sourcemap: true,
// skipNodeModulesBundle: true,
// outDir: "dist"
// plugins: [stripComments({ type: "keep-jsdoc" })],
globalName: "SVGPathCommander",
};
export default defineConfig([
{ // UMD
...config,
entry: "src/index.ts",
format: "umd",
minify: true,
target: "esnext",
platform: "browser",
banner: miniBanner.replace("$package", "UMD"),
plugins: [stripComments({ type: "none" })],
deps: {
alwaysBundle: ["@thednp/dommatrix"],
},
outputOptions: {
file: "dist/index.min.js",
},
},
{ // ESM
...config,
entry: "src/index.ts",
target: "esnext",
platform: "neutral",
treeshake: true,
format: ["esm"],
plugins: [stripComments({ type: "keep-jsdoc" })],
banner: banner.replace("$package", "ESM"),
deps: {
skipNodeModulesBundle: true,
neverBundle: ["@thednp/dommatrix"],
},
outputOptions: {
dir: "dist",
},
},
{ // UTIL
...config,
entry: {
util: "src/util.ts",
},
format: "esm",
platform: "neutral",
target: "esnext",
treeshake: true,
plugins: [stripComments({ type: "keep-jsdoc" })],
banner: banner.replace("$package", "UTIL"),
outputOptions: {
dir: "dist",
},
},
]);