mirror of
https://github.com/setube/ogame-vue-ts.git
synced 2026-05-12 16:05:12 +08:00
feat(electron): 引入 Electron 桌面应用支持
- 添加 Electron 主进程入口文件 main.ts - 配置 Vite 插件以支持 Electron 构建 - 更新 package.json 添加 Electron 相关依赖和构建脚本 - 修改路由历史模式为 HashHistory 以兼容 Electron 环境 - 调整构建流程分离服务端与客户端打包任务 - 新增 Electron 应用图标和基础窗口配置 - 集成开发服务器 URL 加载逻辑与静态文件加载 fallback - 更新构建日期并设置主进程入口点字段 - 添加 Windows 安装包构建目标及输出目录配置 - 优化依赖预构建列表以提升启动性能 - 分离 release 资源收集路径并增强跨平台兼容性 - 升级部分工具链版本以获得最新功能支持
This commit is contained in:
23
electron/main.ts
Normal file
23
electron/main.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { app, BrowserWindow } from 'electron'
|
||||
// @ts-ignore
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { dirname } from 'node:path'
|
||||
|
||||
app.whenReady().then(() => {
|
||||
// @ts-ignore
|
||||
const __filename = fileURLToPath(import.meta.url)
|
||||
const __dirname = dirname(__filename)
|
||||
const win = new BrowserWindow({
|
||||
title: 'OGame',
|
||||
icon: path.join(__dirname, '../public/favicon.ico'),
|
||||
})
|
||||
|
||||
// You can use `process.env.VITE_DEV_SERVER_URL` when the vite command is called `serve`
|
||||
if (process.env.VITE_DEV_SERVER_URL) {
|
||||
win.loadURL(process.env.VITE_DEV_SERVER_URL)
|
||||
} else {
|
||||
// Load your file
|
||||
win.loadFile('docs/index.html');
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user