-
-
Notifications
You must be signed in to change notification settings - Fork 98
Expand file tree
/
Copy pathtsdown.config.ts
More file actions
44 lines (43 loc) · 1.04 KB
/
tsdown.config.ts
File metadata and controls
44 lines (43 loc) · 1.04 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
import { defineConfig } from "tsdown";
export default defineConfig({
entry: [
"src/mod.ts",
"src/kv.ts",
"src/mq.ts",
"src/sqlite.node.ts",
"src/sqlite.bun.ts",
],
dts: { compilerOptions: { isolatedDeclarations: true, declaration: true } },
unbundle: true,
format: ["esm", "cjs"],
platform: "node",
outExtensions({ format }) {
return {
js: format === "cjs" ? ".cjs" : ".js",
dts: format === "cjs" ? ".d.cts" : ".d.ts",
};
},
inputOptions: {
onwarn(warning, defaultHandler) {
if (
warning.code === "UNRESOLVED_IMPORT" &&
["#sqlite", "bun:sqlite"].includes(warning.exporter ?? "")
) {
return;
}
defaultHandler(warning);
},
},
outputOptions(outputOptions, format) {
if (format === "cjs") {
outputOptions.intro = `
const { Temporal } = require("@js-temporal/polyfill");
`;
} else {
outputOptions.intro = `
import { Temporal } from "@js-temporal/polyfill";
`;
}
return outputOptions;
},
});