-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbundle.mjs
More file actions
29 lines (26 loc) · 818 Bytes
/
Copy pathbundle.mjs
File metadata and controls
29 lines (26 loc) · 818 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
import { build } from 'esbuild';
import { resolve, dirname } from 'path';
import { fileURLToPath } from 'url';
const __dirname = dirname(fileURLToPath(import.meta.url));
const root = resolve(__dirname, '..');
await build({
entryPoints: [resolve(root, 'src/cli.ts')],
bundle: true,
platform: 'node',
format: 'cjs',
target: 'node20',
outfile: resolve(root, 'dist/cli.bundle.js'),
// pino-pretty 仅在开发模式使用,生产模式不会加载
external: ['pino-pretty'],
// 动态 import 的 TUI 路径无法静态解析,保持原样
splitting: false,
sourcemap: true,
minify: false,
define: {
'process.env.NODE_ENV': JSON.stringify('production'),
},
logOverride: {
'commonjs-variable-in-esm': 'silent',
},
});
console.log('Backend bundle written to dist/cli.bundle.js');