2026-03-17 03:29:24 +00:00
|
|
|
import { resolve } from 'path'
|
|
|
|
|
import { defineConfig } from 'electron-vite'
|
|
|
|
|
import react from '@vitejs/plugin-react'
|
2026-03-17 05:27:51 +00:00
|
|
|
import tailwindcss from '@tailwindcss/vite'
|
2026-03-17 03:29:24 +00:00
|
|
|
|
|
|
|
|
export default defineConfig({
|
2026-04-17 05:42:41 +00:00
|
|
|
main: {
|
|
|
|
|
build: {
|
2026-04-17 16:29:29 +00:00
|
|
|
// Why: daemon-entry.js is asar-unpacked so child_process.fork() can
|
|
|
|
|
// execute it from disk. Node's module resolution from the unpacked
|
|
|
|
|
// directory cannot reach into app.asar, so pure-JS dependencies used
|
|
|
|
|
// by the daemon must be bundled rather than externalized.
|
|
|
|
|
externalizeDeps: {
|
|
|
|
|
exclude: ['@xterm/headless', '@xterm/addon-serialize']
|
|
|
|
|
},
|
2026-04-17 05:42:41 +00:00
|
|
|
rollupOptions: {
|
|
|
|
|
input: {
|
|
|
|
|
index: resolve('src/main/index.ts'),
|
|
|
|
|
'daemon-entry': resolve('src/main/daemon/daemon-entry.ts')
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-04-17 16:29:29 +00:00
|
|
|
},
|
|
|
|
|
// Why: @xterm/headless declares "exports": null in package.json, which
|
|
|
|
|
// prevents Vite's default resolver from finding the CJS entry. Point
|
|
|
|
|
// directly at the published main file so the bundler can inline it.
|
|
|
|
|
resolve: {
|
|
|
|
|
alias: {
|
|
|
|
|
'@xterm/headless': resolve('node_modules/@xterm/headless/lib-headless/xterm-headless.js'),
|
|
|
|
|
'@xterm/addon-serialize': resolve(
|
|
|
|
|
'node_modules/@xterm/addon-serialize/lib/addon-serialize.js'
|
|
|
|
|
)
|
|
|
|
|
}
|
2026-04-17 05:42:41 +00:00
|
|
|
}
|
|
|
|
|
},
|
2026-03-25 16:59:19 +00:00
|
|
|
preload: {
|
|
|
|
|
build: {
|
|
|
|
|
externalizeDeps: {
|
|
|
|
|
exclude: ['@electron-toolkit/preload']
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2026-03-17 03:29:24 +00:00
|
|
|
renderer: {
|
|
|
|
|
resolve: {
|
|
|
|
|
alias: {
|
2026-03-17 08:40:24 +00:00
|
|
|
'@renderer': resolve('src/renderer/src'),
|
|
|
|
|
'@': resolve('src/renderer/src')
|
2026-03-17 03:29:24 +00:00
|
|
|
}
|
|
|
|
|
},
|
2026-03-22 18:47:22 +00:00
|
|
|
plugins: [react(), tailwindcss()],
|
|
|
|
|
worker: {
|
|
|
|
|
format: 'es'
|
|
|
|
|
}
|
2026-03-17 03:29:24 +00:00
|
|
|
}
|
|
|
|
|
})
|