2026-07-09 10:20:18 +08:00
|
|
|
import { resolve } from 'node:path';
|
|
|
|
|
import { defineConfig, externalizeDepsPlugin } from 'electron-vite';
|
|
|
|
|
import vue from '@vitejs/plugin-vue';
|
|
|
|
|
|
2026-07-09 16:25:59 +08:00
|
|
|
// The app main/preload/renderer are TypeScript + ESM. Each main-process module
|
|
|
|
|
// is its own rollup input so it is emitted to out/main/<name>.js and the
|
|
|
|
|
// relative imports between them (and `new Worker(__dirname/indexer-worker.js)`)
|
|
|
|
|
// resolve to the built .js at runtime.
|
2026-07-09 10:20:18 +08:00
|
|
|
export default defineConfig({
|
|
|
|
|
main: {
|
|
|
|
|
plugins: [externalizeDepsPlugin()],
|
|
|
|
|
build: {
|
|
|
|
|
rollupOptions: {
|
|
|
|
|
input: {
|
2026-07-09 16:25:59 +08:00
|
|
|
index: resolve('src/main/index.ts'),
|
2026-07-31 03:11:55 +08:00
|
|
|
'file-reference': resolve('src/main/file-reference.ts'),
|
2026-07-09 16:25:59 +08:00
|
|
|
indexer: resolve('src/main/indexer.ts'),
|
|
|
|
|
'indexer-service': resolve('src/main/indexer-service.ts'),
|
|
|
|
|
'indexer-worker': resolve('src/main/indexer-worker.ts'),
|
|
|
|
|
'indexer-worker-client': resolve('src/main/indexer-worker-client.ts'),
|
|
|
|
|
'recap-capture-query': resolve('src/main/recap-capture-query.ts'),
|
2026-07-09 10:20:18 +08:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
preload: {
|
|
|
|
|
plugins: [externalizeDepsPlugin()],
|
2026-07-09 11:02:20 +08:00
|
|
|
build: {
|
|
|
|
|
rollupOptions: {
|
|
|
|
|
// Electron sandbox does not support ESM preload — emit CJS index.js
|
|
|
|
|
// (main loads ../preload/index.js) even though the project is ESM.
|
|
|
|
|
output: { format: 'cjs', entryFileNames: '[name].js' },
|
|
|
|
|
},
|
|
|
|
|
},
|
2026-07-09 10:20:18 +08:00
|
|
|
},
|
|
|
|
|
renderer: {
|
|
|
|
|
plugins: [vue()],
|
|
|
|
|
},
|
|
|
|
|
});
|