2026-10-26 02:38:17 -04:00
|
|
|
|
import { resolve } from "node:path";
|
|
|
|
|
|
import { defineConfig, externalizeDepsPlugin } from "electron-vite";
|
|
|
|
|
|
import react from "@vitejs/plugin-react";
|
|
|
|
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
|
|
main: {
|
2026-11-04 04:19:32 -05:00
|
|
|
|
// ws 必须外部化运行时 require:打包进 bundle 时其可选原生依赖 bufferutil 的解析产物
|
|
|
|
|
|
// 会破坏 mask fallback(客户端发帧静默丢字节 / 报 mask is not a function)
|
|
|
|
|
|
plugins: [externalizeDepsPlugin({ include: ["ws"] })],
|
2026-10-26 02:38:17 -04:00
|
|
|
|
resolve: {
|
2026-11-03 23:36:03 -05:00
|
|
|
|
alias: [
|
|
|
|
|
|
{ find: "@shared", replacement: resolve("src/shared") },
|
|
|
|
|
|
// rpa-core 包以源码形式打进主进程产物(不作为外部依赖运行时 require)
|
|
|
|
|
|
{ find: /^@rpa\/core$/, replacement: resolve("packages/rpa-core/src/index.ts") },
|
|
|
|
|
|
{ find: /^@rpa\/core\/capabilities$/, replacement: resolve("packages/rpa-core/src/capabilities/index.ts") }
|
|
|
|
|
|
]
|
2026-10-26 02:38:17 -04:00
|
|
|
|
},
|
|
|
|
|
|
build: {
|
|
|
|
|
|
rollupOptions: {
|
2026-11-01 22:51:55 -05:00
|
|
|
|
input: { index: resolve("src/main/index.ts"), "local-vision/ui-detect-worker": resolve("src/main/local-vision/ui-detect-worker.ts") }
|
2026-10-26 02:38:17 -04:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
preload: {
|
|
|
|
|
|
plugins: [externalizeDepsPlugin()],
|
|
|
|
|
|
resolve: {
|
|
|
|
|
|
alias: {
|
|
|
|
|
|
"@shared": resolve("src/shared")
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
build: {
|
|
|
|
|
|
rollupOptions: {
|
|
|
|
|
|
input: { index: resolve("src/preload/index.ts") }
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
renderer: {
|
|
|
|
|
|
plugins: [react()],
|
|
|
|
|
|
resolve: {
|
|
|
|
|
|
alias: {
|
|
|
|
|
|
"@shared": resolve("src/shared"),
|
|
|
|
|
|
"@renderer": resolve("src/renderer/src")
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|