feat(desktop-client): 阶段4-6 Electron EXE 客户端(登录/课表/作业/通知/成绩/设置 + Socket.IO 实时 + IndexedDB 离线缓存与自动同步 + electron-builder 打包)
This commit is contained in:
1 parent
4566d7cd5e
commit
6e4c7c1050
42 files changed
+5767
-60
No files matched your search
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* 主进程 / preload 构建:esbuild 打包为 CommonJS。
|
||||
* - external: electron(由 Electron 运行时提供)
|
||||
* - @classhelper/shared 会被内联打包(ESM 源码 -> CJS 产物)
|
||||
*/
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { build } from 'esbuild';
|
||||
|
||||
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
||||
|
||||
const shared = {
|
||||
bundle: true,
|
||||
platform: 'node',
|
||||
target: 'node20',
|
||||
format: 'cjs',
|
||||
sourcemap: false,
|
||||
external: ['electron'],
|
||||
logLevel: 'warning',
|
||||
define: {
|
||||
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV ?? 'production'),
|
||||
},
|
||||
};
|
||||
|
||||
await build({
|
||||
...shared,
|
||||
entryPoints: [path.join(root, 'src/main/index.ts')],
|
||||
outfile: path.join(root, 'dist/main/index.js'),
|
||||
});
|
||||
|
||||
await build({
|
||||
...shared,
|
||||
entryPoints: [path.join(root, 'src/preload/index.ts')],
|
||||
outfile: path.join(root, 'dist/preload/index.js'),
|
||||
});
|
||||
|
||||
console.log('[build:main] dist/main/index.js 与 dist/preload/index.js 构建完成');
|
||||
Reference in new issue
Block a user