feat: dev:web 纯浏览器开发通道(绕开 Electron 窗口/Tabbit localhost 劫持)

【背景】npm run dev 构建链全绿正常;但用户环境 Tabbit 浏览器后台 node 劫持 localhost 端口段
(5173/5179 全 502)——非我们 dev 故障
【方案】vite.web.config.ts:root=src/renderer+react 插件+port 5179+host 0.0.0.0;
package.json scripts.dev:web=vite --config vite.web.config.ts
【用法】WSL:npm run dev:web → Windows 浏览器:http://<WSL_IP>:5179(设备 localhost 不可用场景)
window.api(导出/导入/MOD 扫描)不存在时自动跳过——其余全功能等价(存档走浏览器 OPFS)
【验证】Windows 侧 curl http://192.168.1.225:5179/ = 200
This commit is contained in:
2026-08-24 22:07:48 +08:00
parent e36937ade2
commit 9323963dd4
2 changed files with 13 additions and 1 deletions
+11
View File
@@ -0,0 +1,11 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// 纯浏览器开发调试(无需 Electron 窗口):
// npm run dev:web → 浏览器打开 http://localhost:5173 直接游玩
// 差异说明:window.api(存档导出/导入、MOD 扫描)不存在时自动跳过——其余全功能等价。
export default defineConfig({
root: 'src/renderer',
plugins: [react()],
server: { port: 5179, strictPort: true, host: '0.0.0.0' }
})