Files
gitlab-instance-0a899031_d2…/electron/electron.vite.config.ts
2026-07-10 05:15:29 -05:00

77 lines
1.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import react from '@vitejs/plugin-react'
import { resolve } from 'path'
/** 与 d2ypp2 next.config dev rewrites 对齐:开发时同源反代 web2避免 localhost→127.0.0.1 跨域 */
const WEB2_DEV_PROXY_TARGET = process.env.API_PROXY_TARGET || 'http://127.0.0.1:8001'
const WEB2_DEV_PROXY_PREFIXES = [
'/client',
'/relay_pro',
'/douyin',
'/host',
'/get_config',
'/save_config',
'/youtube',
'/get_url_config',
'/save_url_config',
'/camera',
'/pull_stream',
'/start',
'/stop',
'/restart',
'/status',
'/health',
'/proxy_config',
'/system_metrics',
'/config',
'/process_monitor',
'/network_status',
'/network_toolkit',
'/ip_profile',
'/ip_quality',
]
export default defineConfig({
main: {
resolve: {
alias: {
'@shared': resolve('src/shared'),
},
},
plugins: [externalizeDepsPlugin()],
},
preload: {
resolve: {
alias: {
'@shared': resolve('src/shared'),
},
},
plugins: [externalizeDepsPlugin()],
build: {
rollupOptions: {
output: {
format: 'cjs',
entryFileNames: 'index.js',
},
},
},
},
renderer: {
resolve: {
alias: {
'@renderer': resolve('src/renderer/src'),
'@shared': resolve('src/shared'),
},
},
plugins: [react()],
server: {
proxy: Object.fromEntries(
WEB2_DEV_PROXY_PREFIXES.map((prefix) => [
prefix,
{ target: WEB2_DEV_PROXY_TARGET, changeOrigin: true },
]),
),
},
},
})