-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathvite.config.ts
More file actions
36 lines (35 loc) · 919 Bytes
/
vite.config.ts
File metadata and controls
36 lines (35 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { resolve } from "node:path";
import react from "@vitejs/plugin-react";
import UnoCSS from "unocss/vite";
import { defineConfig } from "vite";
// https://vite.dev/config/
export default defineConfig({
base: "./",
server: {
// Tauri 工作于固定端口,如果端口不可用则报错
strictPort: true,
port: 5173,
},
clearScreen: false,
// 添加有关当前构建目标的额外前缀,使这些 CLI 设置的 Tauri 环境变量可以在客户端代码中访问
envPrefix: ["VITE_", "TAURI_ENV_"],
build: {
minify: !process.env.TAURI_ENV_DEBUG,
// 在 debug 构建中生成 sourcemap
sourcemap: !!process.env.TAURI_ENV_DEBUG,
},
plugins: [react(), UnoCSS()],
resolve: {
// 设置文件./src路径为 @
alias: [
{
find: "@",
replacement: resolve(__dirname, "./src"),
},
{
find: "@pkg",
replacement: resolve(__dirname, "./package.json"),
},
],
},
});