-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathtsup.config.ts
More file actions
55 lines (52 loc) · 1.34 KB
/
tsup.config.ts
File metadata and controls
55 lines (52 loc) · 1.34 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
import { defineConfig, type Options } from "tsup";
import pkg from "./package.json" with { type: "json" };
export default defineConfig({
banner: ({ format }) =>
// See https://stackoverflow.com/a/77753164
format === "esm"
? {
js: `import * as ___react___ from 'react';
import * as ___react_dom___ from 'react-dom';
function require(mod) {
if (mod === 'react') return ___react___;
if (mod === 'react-dom') return ___react_dom___;
throw new Error(\`Unknown module \${mod}\`);
}`,
}
: undefined,
bundle: true,
cjsInterop: true,
clean: true,
env: {
NODE_ENV: process.env.CI ?? "development",
},
define: {
VERSION_INJECTED_AT_BUILD_TIME: `"${pkg.version}"`,
},
dts: true,
entry: [
"./data/bff/index.ts",
"./data/index.ts",
"./data/mysql-core/index.ts",
"./data/mysql2/index.ts",
"./data/node-sqlite/index.ts",
"./data/pglite/index.ts",
"./data/postgres-core/index.ts",
"./data/postgresjs/index.ts",
"./data/sqlite-core/index.ts",
"./data/sqljs/index.ts",
"./ui/index.css",
"./ui/index.tsx",
],
external: ["@types/react", "react", "react-dom"],
format: ["cjs", "esm"],
metafile: true,
minify: true,
outDir: "dist",
platform: "browser",
sourcemap: "inline",
loader: {
".css": "copy",
".svg": "dataurl",
},
} satisfies Options);