-
Notifications
You must be signed in to change notification settings - Fork 2
/
tsup.config.ts
69 lines (67 loc) · 1.6 KB
/
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
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
import { defineConfig, Options } from "tsup";
import { solidPlugin } from "esbuild-plugin-solid";
import { readFileSync } from "node:fs";
const VERSION = JSON.parse(readFileSync("package.json", "utf-8")).version;
export default defineConfig(
(config) =>
[
{
entry: ["src/index.tsx"],
format: ["esm", "cjs"],
dts: true,
clean: !config.watch,
minify: true,
esbuildPlugins: [solidPlugin()],
env: {
VERSION,
},
loader: {
".wasm": "file",
},
},
{
entry: ["src/index.tsx"],
format: ["iife"],
clean: !config.watch,
minify: true,
esbuildPlugins: [solidPlugin()],
env: {
VERSION,
},
globalName: "__docsearch_infini__",
platform: "browser",
footer: {
js: "if (!'__docsearch_infini__' in window) window.__docsearch_infini__ = __docsearch_infini__",
},
loader: {
".wasm": "file",
},
},
{
entry: ["src/index.solid.tsx"],
format: "esm",
dts: true,
clean: !config.watch,
minify: true,
esbuildOptions: () => ({
jsx: "preserve",
}),
outExtension: () => ({
js: ".jsx",
}),
env: {
VERSION,
},
},
{
entry: [
"src/styles/index.css",
"src/styles/variables.css",
"src/styles/button.css",
"src/styles/modal.css",
],
clean: !config.watch,
minify: true,
},
] as Options[],
);