-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathtsdown.electron.config.ts
More file actions
69 lines (66 loc) · 1.73 KB
/
tsdown.electron.config.ts
File metadata and controls
69 lines (66 loc) · 1.73 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
// ESM polyfill for __dirname and __filename
const esmShim = `
import { fileURLToPath as __fileURLToPath } from 'node:url';
import { dirname as __pathDirname } from 'node:path';
const __filename = __fileURLToPath(import.meta.url);
const __dirname = __pathDirname(__filename);
`;
// Packages with native .node binaries must be externalized
const nativeExternals = [
"node-llama-cpp",
"@reflink/reflink",
"@reflink/reflink-darwin-arm64",
"@reflink/reflink-darwin-x64",
"@reflink/reflink-linux-arm64-gnu",
"@reflink/reflink-linux-x64-gnu",
"fsevents",
"koffi",
"canvas",
"onnxruntime-node",
"sharp",
/^@electric-sql\/pglite/,
];
const commonConfig = {
format: "esm",
platform: "node",
outDir: "dist-electron",
banner: { js: esmShim },
noExternal: [/.*/, "json5"],
external: nativeExternals,
fixedExtension: false,
inlineOnly: false,
env: { NODE_ENV: "production" },
};
export default [
{
...commonConfig,
entry: "src/index.ts",
},
{
...commonConfig,
entry: "src/entry.ts",
},
{
...commonConfig,
entry: "src/runtime/eliza.ts",
// Disable code splitting to prevent circular chunk dependencies.
outputOptions: { codeSplitting: false },
},
{
...commonConfig,
entry: "src/api/server.ts",
// Disable code splitting to prevent circular chunk dependencies.
// Without this, rolldown places the __exportAll runtime helper in the
// entry chunk and shared chunks import it back, creating a circular
// import that fails when Electron loads server.js via dynamic import().
outputOptions: { codeSplitting: false },
},
{
...commonConfig,
entry: "src/plugins/whatsapp/index.ts",
},
{
...commonConfig,
entry: "src/plugins/retake/index.ts",
},
];