-
Notifications
You must be signed in to change notification settings - Fork 355
Expand file tree
/
Copy pathtsdown.config.ts
More file actions
35 lines (33 loc) · 1017 Bytes
/
tsdown.config.ts
File metadata and controls
35 lines (33 loc) · 1017 Bytes
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
import { defineConfig } from "tsdown";
import packageJson from "./package.json" with { type: "json" };
/** Collect all declared dependencies that must NOT be bundled. */
function collectExternalDependencies(): string[] {
return [
...Object.keys(packageJson.dependencies ?? {}),
...Object.keys(packageJson.peerDependencies ?? {}),
...Object.keys(packageJson.optionalDependencies ?? {}),
];
}
export default defineConfig({
entry: ["./index.ts"],
outDir: "./dist",
format: "esm",
platform: "node",
clean: true,
fixedExtension: true,
dts: false,
sourcemap: false,
deps: {
neverBundle: (id) => {
// openclaw SDK — always external
if (id === "openclaw" || id.startsWith("openclaw/")) return true;
// node: builtins
if (id.startsWith("node:")) return true;
// all declared dependencies
for (const dep of collectExternalDependencies()) {
if (id === dep || id.startsWith(`${dep}/`)) return true;
}
return false;
},
},
});