build(app): migrate to electron-vite (main/preload/renderer), keep electron-builder (Phase 5d-3a)
Restructure app into src/{main,preload,renderer}; electron.vite.config.ts builds
all three (each main module its own input so CJS requires + the indexer worker
resolve; better-sqlite3 externalized; Vue plugin for renderer). main/index.js
paths updated for the out/ layout + ELECTRON_RENDERER_URL. Still JS/CJS — TS+ESM
and core consumption are the next stages. Verified: npm run dev launches clean;
electron-vite build succeeds; root suite 119/119.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { resolve } from 'node:path';
|
||||
import { defineConfig, externalizeDepsPlugin } from 'electron-vite';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
|
||||
// Kept CommonJS for the first electron-vite boot (no "type":"module" yet); the
|
||||
// TS + ESM migration is a later stage. Each main-process module is its own input
|
||||
// so it is emitted to out/main/<name>.js and the CommonJS require("./x") calls
|
||||
// between them (and `new Worker(__dirname/indexer-worker.js)`) resolve at runtime.
|
||||
export default defineConfig({
|
||||
main: {
|
||||
plugins: [externalizeDepsPlugin()],
|
||||
build: {
|
||||
rollupOptions: {
|
||||
input: {
|
||||
index: resolve('src/main/index.js'),
|
||||
indexer: resolve('src/main/indexer.js'),
|
||||
'indexer-service': resolve('src/main/indexer-service.js'),
|
||||
'indexer-worker': resolve('src/main/indexer-worker.js'),
|
||||
'indexer-worker-client': resolve('src/main/indexer-worker-client.js'),
|
||||
'recap-capture-query': resolve('src/main/recap-capture-query.js'),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
preload: {
|
||||
plugins: [externalizeDepsPlugin()],
|
||||
},
|
||||
renderer: {
|
||||
plugins: [vue()],
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user