chore: add browser development command

This commit is contained in:
2026-08-03 11:32:02 +08:00
parent a936117d9e
commit 6e37cb9076
2 changed files with 6 additions and 0 deletions
+5
View File
@@ -27,6 +27,9 @@ npm install
# 日常开发:启动 Vite 热更新 + 未打包的 Tauri 桌面壳 # 日常开发:启动 Vite 热更新 + 未打包的 Tauri 桌面壳
npm run desktop:dev npm run desktop:dev
# 纯 Web 开发:仅启动 Vite,在浏览器打开 http://127.0.0.1:1420
npm run web:dev
# 仅检查并构建前端静态文件 # 仅检查并构建前端静态文件
npm run build npm run build
@@ -39,6 +42,8 @@ npm run tauri build -- --debug
`npm run desktop:dev` 不生成 `.app``.dmg` 或安装包。前端 TypeScript / CSS / HTML 保存后会由 Vite 自动热更新;改动 `src-tauri/` 中的 Rust Host 代码时,Tauri 会重新编译并重启开发窗口。只有需要交付可安装文件时才执行 `tauri build` `npm run desktop:dev` 不生成 `.app``.dmg` 或安装包。前端 TypeScript / CSS / HTML 保存后会由 Vite 自动热更新;改动 `src-tauri/` 中的 Rust Host 代码时,Tauri 会重新编译并重启开发窗口。只有需要交付可安装文件时才执行 `tauri build`
`npm run web:dev` 只运行同一份可信 Host Web UI,适合在浏览器中快速调试登录、消息和 Renderer。它不具备 Tauri 原生能力,也不应作为第三方 Mini Runtime Surface 的安全验收环境。AppServer 已对固定开发 Origin `http://127.0.0.1:1420` 配置 CORS;若改动 Vite 端口或 host,必须同步收紧更新 AppServer 的 `client.allowedOrigins`
本项目的 `tauri``check:rust` npm 脚本会自动识别 Linux x86_64、macOS Apple Silicon、macOS Intel 的 Rust stable toolchain,并加入 `PATH`。因此不要直接执行裸 `tauri build`;统一使用 `npm run tauri build -- --debug`。如 Rust toolchain 安装在其他位置,可临时覆盖: 本项目的 `tauri``check:rust` npm 脚本会自动识别 Linux x86_64、macOS Apple Silicon、macOS Intel 的 Rust stable toolchain,并加入 `PATH`。因此不要直接执行裸 `tauri build`;统一使用 `npm run tauri build -- --debug`。如 Rust toolchain 安装在其他位置,可临时覆盖:
```bash ```bash
+1
View File
@@ -5,6 +5,7 @@
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite --host 127.0.0.1 --port 1420", "dev": "vite --host 127.0.0.1 --port 1420",
"web:dev": "npm run dev",
"desktop:dev": "./scripts/tauri.sh dev", "desktop:dev": "./scripts/tauri.sh dev",
"build": "tsc --noEmit && vite build", "build": "tsc --noEmit && vite build",
"preview": "vite preview --host 127.0.0.1", "preview": "vite preview --host 127.0.0.1",