mirror of
https://github.com/ZSeven-W/openpencil.git
synced 2026-06-01 03:14:29 +07:00
- Add Electron configuration and main process setup for building a desktop application. - Implement IPC communication for file operations (open, save) between the renderer and main processes. - Create a preload script to expose Electron APIs to the renderer. - Update package.json to include Electron and related dependencies. - Enhance the build process with electron-builder for packaging the application. - Introduce a new electron-builder.yml configuration file for build settings. - Modify Vite configuration to support Electron-specific builds. - Update UI components to accommodate Electron's window management and drag regions.
38 lines
1 KiB
TypeScript
38 lines
1 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import { devtools } from '@tanstack/devtools-vite'
|
|
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
|
|
import viteReact from '@vitejs/plugin-react'
|
|
import viteTsConfigPaths from 'vite-tsconfig-paths'
|
|
import { fileURLToPath, URL } from 'node:url'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
import { nitro } from 'nitro/vite'
|
|
|
|
const isElectronBuild = process.env.BUILD_TARGET === 'electron'
|
|
|
|
const config = defineConfig({
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
},
|
|
},
|
|
ssr: {
|
|
external: ['@opencode-ai/sdk'],
|
|
},
|
|
plugins: [
|
|
devtools(),
|
|
nitro({
|
|
rollupConfig: { external: [/^@sentry\//, /^@opencode-ai\//] },
|
|
serverDir: './server',
|
|
...(isElectronBuild ? { preset: 'node-server' } : {}),
|
|
}),
|
|
// this is the plugin that enables path aliases
|
|
viteTsConfigPaths({
|
|
projects: ['./tsconfig.json'],
|
|
}),
|
|
tailwindcss(),
|
|
tanstackStart(),
|
|
viteReact(),
|
|
],
|
|
})
|
|
|
|
export default config
|