veritas-kanban/desktop/electron.vite.config.ts
Brad Groux 2f18229ff2
fix: add authoritative native version information (#1009)
* fix: add authoritative native version information

* docs: explain native version support

* fix: pin patched brace expansion release

* fix: embed desktop release channel
2026-07-24 17:29:10 -05:00

67 lines
1.8 KiB
TypeScript

import { resolve } from 'node:path';
import { defineConfig, externalizeDepsPlugin } from 'electron-vite';
const electronRuntimeExternal = ['electron', /^electron\/.+/];
export default defineConfig({
main: {
plugins: [externalizeDepsPlugin()],
define: {
__VERITAS_BUILD_SHA__: JSON.stringify(
process.env.VERITAS_BUILD_SHA ?? process.env.GITHUB_SHA ?? ''
),
__VERITAS_RELEASE_CHANNEL__: JSON.stringify(process.env.VERITAS_UPDATE_CHANNEL ?? ''),
},
build: {
// Vite 8 builds with Rolldown. Electron Vite 5 still places its built-in
// runtime externals under rollupOptions, which Rolldown does not consume.
// Keep Electron explicitly external so the emitted main process receives
// Electron's runtime API instead of bundling the npm executable-path shim.
rolldownOptions: {
external: electronRuntimeExternal,
input: {
index: resolve(__dirname, 'src/main/index.ts'),
},
},
rollupOptions: {
input: {
index: resolve(__dirname, 'src/main/index.ts'),
},
},
},
},
preload: {
plugins: [externalizeDepsPlugin()],
build: {
rolldownOptions: {
external: electronRuntimeExternal,
input: {
index: resolve(__dirname, 'src/preload/index.ts'),
},
output: {
format: 'cjs',
entryFileNames: '[name].cjs',
},
},
rollupOptions: {
input: {
index: resolve(__dirname, 'src/preload/index.ts'),
},
output: {
format: 'cjs',
entryFileNames: '[name].cjs',
},
},
},
},
renderer: {
root: resolve(__dirname, 'src/renderer'),
build: {
rollupOptions: {
input: {
index: resolve(__dirname, 'src/renderer/index.html'),
},
},
},
},
});