feat(project): 初始化 Tauri + Vue + TypeScript 项目
- 添加项目基础配置文件 package.json、tsconfig.json 和 vite.config.ts - 配置 Git 忽略规则 .gitignore 包含构建产物和开发环境文件 - 设置 VSCode 推荐插件 extensions.json 包含 Volar、Tauri 和 Rust 分析器 - 创建项目主页 index.html 和应用入口 src/main.ts - 添加 README.md 包含项目介绍和推荐的 IDE 设置 - 安装依赖包包括 @tauri-apps/api、vue、vue-router 等核心库 - 生成 pnpm 锁定文件 pnpm-lock.yaml 确保依赖版本一致性
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { defineConfig } from "vite";
|
||||
import vue from "@vitejs/plugin-vue";
|
||||
|
||||
// @ts-expect-error process is a nodejs global
|
||||
const host = process.env.TAURI_DEV_HOST;
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig(async () => ({
|
||||
plugins: [vue()],
|
||||
|
||||
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
|
||||
//
|
||||
// 1. prevent Vite from obscuring rust errors
|
||||
clearScreen: false,
|
||||
// 2. tauri expects a fixed port, fail if that port is not available
|
||||
server: {
|
||||
port: 1420,
|
||||
strictPort: true,
|
||||
host: host || false,
|
||||
hmr: host
|
||||
? {
|
||||
protocol: "ws",
|
||||
host,
|
||||
port: 1421,
|
||||
}
|
||||
: undefined,
|
||||
watch: {
|
||||
// 3. tell Vite to ignore watching `src-tauri`
|
||||
ignored: ["**/src-tauri/**"],
|
||||
},
|
||||
},
|
||||
}));
|
||||
Reference in New Issue
Block a user