Pulls the worker process entry point, parent<->worker IPC plumbing, message validation schema, and crash-recovery handler into a single src/main/worker/entry/ module. No runtime behavior changes — only directory + file-name renames plus import-path updates: worker-entry.ts -> entry/index.ts, worker-message-handler.ts -> entry/message-handler.ts, worker-rpc.ts -> entry/rpc.ts, worker-crash-recovery.ts -> entry/crash-recovery.ts, worker-types.ts -> entry/types.ts. electron.vite.config.ts, worker-service.ts, handlers/*.ts, pi-agent-factory.ts, and worker-runner.ts updated to point at the new locations.
58 lines
1.4 KiB
TypeScript
58 lines
1.4 KiB
TypeScript
import { resolve } from "node:path";
|
|
import react from "@vitejs/plugin-react";
|
|
import tailwindcss from "@tailwindcss/vite";
|
|
import { defineConfig, externalizeDepsPlugin } from "electron-vite";
|
|
|
|
export default defineConfig({
|
|
main: {
|
|
plugins: [externalizeDepsPlugin()],
|
|
resolve: {
|
|
alias: {
|
|
"@shared": resolve("src/shared"),
|
|
"@main": resolve("src/main"),
|
|
},
|
|
},
|
|
build: {
|
|
rollupOptions: {
|
|
input: {
|
|
index: resolve("src/main/index.ts"),
|
|
worker: resolve("src/main/worker/entry/index.ts"),
|
|
},
|
|
},
|
|
},
|
|
},
|
|
preload: {
|
|
// zod is bundled into preload because preload runs as sandboxed CJS
|
|
// and cannot resolve externalized ESM deps at runtime. Inlining keeps
|
|
// IPC Zod validation working inside the preload layer.
|
|
plugins: [externalizeDepsPlugin({ exclude: ["zod"] })],
|
|
resolve: {
|
|
alias: {
|
|
"@shared": resolve("src/shared"),
|
|
"@preload": resolve("src/preload"),
|
|
},
|
|
},
|
|
build: {
|
|
rollupOptions: {
|
|
input: {
|
|
index: resolve("src/preload/index.ts"),
|
|
},
|
|
output: {
|
|
format: "cjs",
|
|
entryFileNames: "[name].js",
|
|
chunkFileNames: "chunks/[name]-[hash].js",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
renderer: {
|
|
resolve: {
|
|
alias: {
|
|
"@shared": resolve("src/shared"),
|
|
"@renderer": resolve("src/renderer"),
|
|
},
|
|
},
|
|
plugins: [react(), tailwindcss()],
|
|
},
|
|
});
|