-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.mjs
More file actions
42 lines (38 loc) · 1.12 KB
/
Copy pathbuild.mjs
File metadata and controls
42 lines (38 loc) · 1.12 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
/**
* dsh-housekeeper build: ESM host for Node 22 + one CJS client bundle wrapped
* in the web-app ModuleLoader handshake (same shape as dsh-pilot).
* @deepseek-ai/* and react stay external.
*/
import { build } from 'esbuild'
import { mkdirSync } from 'node:fs'
mkdirSync('lib', { recursive: true })
const dshExternal = ['@deepseek-ai/cordis', '@deepseek-ai/dsh-*']
await build({
entryPoints: ['src/index.js'],
outfile: 'lib/index.js',
bundle: true,
format: 'esm',
platform: 'node',
target: ['node22'],
sourcemap: true,
external: dshExternal,
logLevel: 'info',
})
await build({
entryPoints: ['src/client/index.jsx'],
outfile: 'lib/client.js',
bundle: true,
format: 'cjs',
platform: 'browser',
target: ['es2022'],
sourcemap: true,
jsx: 'automatic',
external: [...dshExternal, 'react', 'react-dom', 'react/jsx-runtime', 'react/jsx-dev-runtime', 'scheduler'],
banner: {
js: "window.__ModuleLoader__.load({ id: 'dsh-housekeeper', factory: (require) => { var module = { exports: {} }; var exports = module.exports;",
},
footer: {
js: 'return module.exports; } });',
},
logLevel: 'info',
})