Files
WEP-56 e4ab246f0f chore(release): v1.0.1
- 版本号 1.0.1(package.json / tauri.conf.json / Cargo.toml)
- 界面版本改为构建时从 package.json 注入(__APP_VERSION__),不再写死
- README 精简:移除功能清单
2026-11-04 16:30:25 +08:00

32 lines
928 B
TypeScript

import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import tailwindcss from "@tailwindcss/vite";
import { readFileSync } from "node:fs";
const host = process.env.TAURI_DEV_HOST;
const { version } = JSON.parse(
readFileSync(new URL("./package.json", import.meta.url), "utf8"),
) as { version: string };
export default defineConfig({
plugins: [react(), tailwindcss()],
clearScreen: false,
// 版本号只维护 package.json(CI 会按 tag 改写它),界面里的版本由这里注入,避免写死后漂移
define: {
__APP_VERSION__: JSON.stringify(version),
},
server: {
port: 1420,
strictPort: true,
host: host || false,
hmr: host ? { protocol: "ws", host, port: 1421 } : undefined,
watch: { ignored: ["**/src-tauri/**"] },
},
envPrefix: ["VITE_", "TAURI_ENV_*"],
build: {
target: "es2021",
minify: "esbuild",
sourcemap: false,
},
});